You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP →
Socket
Book a DemoInstallSign in
Socket

playwright-bingo

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright-bingo

A powerful testing framework built on top of Playwright and Cucumber, designed to make end-to-end testing more efficient and maintainable

1.2.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
Ā 
Created
Source

Playwright Bingo Framework

A powerful and user-friendly test automation framework built on Playwright and Cucumber.js, designed to make test automation easy and efficient.

Documentation npm version

šŸ“š Documentation

Visit our official documentation site for comprehensive guides and resources.

What's in the Documentation?

SectionDescription
šŸŽÆ Getting StartedQuick start guide and installation instructions
šŸ“– GuidesDetailed tutorials and how-to guides
šŸ” API ReferenceComplete API documentation and examples
šŸ’” Best PracticesRecommended patterns and tips
šŸš€ ExamplesReal-world examples and use cases

šŸ’” Pro Tip: Bookmark the documentation site for quick reference while working with Playwright Bingo.

šŸš€ Features

  • Page Object Model: Clean and maintainable test structure
  • Self-healing Locators: Automatic retry mechanism for flaky elements
  • Data Masking: Secure handling of sensitive test data
  • Parallel Execution: Run tests in parallel for faster execution
  • HTML Reports: Beautiful and detailed test reports
  • CLI Tools: Easy-to-use commands for project management
  • Cucumber Integration: BDD-style test writing with Gherkin syntax
  • Modern UI Testing: Built on Playwright for reliable cross-browser testing

šŸ“¦ Installation

  • Install the framework globally:
npm install -g playwright-bingo
  • Create a new project:
bingo init
  • Install dependencies:
npm install
  • Install Playwright browsers:
npx playwright install

šŸŽ® Usage

Running Tests

# Run all tests
npm test

# Run tests in parallel
npm run test:parallel

# Generate HTML report
npm run test:report

CLI Commands

# Add a new page
bingo add page <pageName>

# Delete a page
bingo delete page <pageName>

# Update page name
bingo update page <oldName> <newName>

# Mask sensitive data
bingo mask <data>

# Unmask data
bingo unmask <maskedData>

šŸ“ Project Structure

playwright-bingo/
ā”œā”€ā”€ features/                    # Cucumber feature files
│   └── todo.feature            # Example Todo feature file
ā”œā”€ā”€ lib/                        # Core framework files
│   ā”œā”€ā”€ index.js               # Main framework exports
│   ā”œā”€ā”€ locators.js            # Locator management
│   ā”œā”€ā”€ page.manager.js        # Page object management
│   └── utils/                 # Utility functions
│       ā”œā”€ā”€ data-masker.js     # Data masking utilities
│       └── properties.js      # Properties file handling
ā”œā”€ā”€ pages/                      # Page objects
│   ā”œā”€ā”€ actions/               # Page actions
│   │   ā”œā”€ā”€ index.js          # Actions exports
│   │   └── todo.actions.js   # Todo page actions
│   └── locators/             # Page locators
│       ā”œā”€ā”€ index.js          # Locators exports
│       └── todo.locators.js  # Todo page locators
ā”œā”€ā”€ step-definitions/          # Cucumber step definitions
│   └── todo.steps.js         # Todo feature steps
ā”œā”€ā”€ support/                   # Support files
│   ā”œā”€ā”€ env-setup.js          # Environment configuration
│   ā”œā”€ā”€ hooks.js              # Cucumber hooks
│   └── world.js              # Custom world setup
ā”œā”€ā”€ tests/                     # Test files
│   └── todo.test.js          # Example test file
ā”œā”€ā”€ .env                      # Environment variables
ā”œā”€ā”€ .gitignore                # Git ignore file
ā”œā”€ā”€ bingo.config.js           # Framework configuration
ā”œā”€ā”€ cucumber.js               # Cucumber configuration
ā”œā”€ā”€ generate-report.js        # HTML report generation
ā”œā”€ā”€ jsconfig.json             # JavaScript configuration
ā”œā”€ā”€ package.json              # Project dependencies
└── README.md                 # Project documentation

āš™ļø Configuration

bingo.config.js

module.exports = {
    selfHealing: {
        enabled: true,
        maxTimeout: 5000,
        retryInterval: 1000,
        maxRetries: 3
    },
    locators: {
        defaultTimeout: 30000,
        waitForTimeout: 5000
    },
    browser: {
        headless: true,
        slowMo: 50
    },
    reporting: {
        screenshots: {
            onFailure: true,
            onSuccess: false
        },
        videos: {
            enabled: true,
            retainOnFailure: true
        }
    },
    dataMasking: {
        enabled: true,
        properties: {
            autoMask: true,
            sensitiveKeys: [
                'password',
                'secret',
                'key',
                'token',
                'credential',
                'apiKey',
                'auth',
                'private'
            ]
        }
    }
};

šŸ”’ Data Masking

The framework includes a powerful data masking system to protect sensitive information in your tests.

Setting Up

  • Create a .env file in your project root:
BINGO_MASK_SALT=your-secret-salt
TEST_EMAIL=test@example.com
TEST_PASSWORD=your-password
  • Mask sensitive data using the CLI:
bingo mask test@example.com
  • Use the masked value in your .env file:
TEST_EMAIL=BINGO_MASK_<hash>

Using Masked Values

const { env } = require('playwright-bingo');

// Access environment variables (automatically decrypted)
console.log(env.TEST_EMAIL);  // Shows original value

Properties File Masking

The framework can automatically mask sensitive values in .properties files:

  • Configure masking in bingo.config.js:
module.exports = {
    dataMasking: {
        enabled: true,
        properties: {
            autoMask: true,
            sensitiveKeys: [
                'password',
                'secret',
                'key',
                'token',
                'credential',
                'apiKey',
                'auth',
                'private'
            ]
        }
    }
};
  • Use the Properties class to handle masked values:
const { properties } = require('playwright-bingo');

// Load properties with automatic masking
properties.load('path/to/properties.file', true);

// Get masked value
const maskedValue = properties.get('db.password');

// Get original value
const originalValue = properties.get('db.password', true);

// Save masked properties to a new file
properties.save('path/to/masked.properties', true);

Automatic Masking

The system automatically detects and masks sensitive data types:

  • Email addresses
  • Credit card numbers
  • Phone numbers
  • Social security numbers
  • API keys
  • Passwords
  • Database credentials
  • JWT tokens
  • Properties file values containing sensitive keys

Debugging

const { debug } = require('playwright-bingo');

// Show all masked values and their originals
debug();

šŸ”„ Self-Healing Locators

The framework includes a powerful self-healing mechanism that automatically recovers from locator failures by trying alternative locators.

Setting Up Multiple Locators

// pages/locators/todo.locators.js
class TodoLocators {
    constructor(page) {
        this.page = page;
        // Define multiple locators for the same element
        this.todoInput = [
            'input[placeholder="What needs to be done?"]',
            'input.new-todo',
            '[data-testid="todo-input"]'
        ];
    }
}

Using Self-Healing in Actions

// pages/actions/todo.actions.js
class TodoActions {
    constructor(bingoPage) {
        this.bingoPage = bingoPage;
        this.todo = new LocatorManager(bingoPage.page).todo;
    }

    async addTodoItem(todoText) {
        // The framework will try each locator until one works
        const input = await this.bingoPage.waitForElement(this.todo.todoInput);
        await input.fill(todoText);
        await input.press('Enter');
    }
}

šŸ“Š Reports

HTML reports are generated automatically after test execution:

npm run test:report

Reports include:

  • Test execution summary
  • Scenario details
  • Screenshots on failure
  • Environment information
  • Execution time

šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

šŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

playwright

FAQs

Package last updated on 12 May 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.