@lambdatest/playwright-node-sdk

1.0.2 • Public • Published

LambdaTest Playwright Node SDK

The LambdaTest Playwright Node SDK is a powerful tool that enables you to run your Playwright tests on LambdaTest's cloud-based testing platform. This SDK provides seamless integration between your local Playwright test suite and LambdaTest's extensive browser and device infrastructure.

Features

  • 🚀 Cloud-based Testing: Run Playwright tests on LambdaTest's cloud infrastructure
  • 🌐 Cross-browser Testing: Support for Chrome, Edge, Playwright Firefox, Playwright Webkit, Playwright Chromium.
  • 📱 Mobile Testing: Test on real mobile devices.
  • 🔧 Easy Configuration: Simple YAML-based configuration
  • 🏗️ Tunnel Support: Secure local testing with LambdaTest tunnel
  • 🔄 Parallel Execution: Run tests in parallel across multiple browsers

Installation

Prerequisites

  • Node.js
  • npm or yarn
  • LambdaTest account and credentials

Install the SDK

npm install @lambdatest/playwright-node-sdk

Quick Start

1. Initialize Configuration (Optional)

You can automatically create a lambdatest.yml file with a default template:

# Create default lambdatest.yml
npx playwright-node-sdk init

# Create with custom filename
npx playwright-node-sdk init my-config.yml

This will create a configuration file with default configurations for Windows, macOS, and Android platforms.

2. Configure LambdaTest Credentials

Create a lambdatest.yml file in your project root (or edit the one created by init):

user: "your-lambdatest-username"
accessKey: "your-lambdatest-access-key"
build: "Playwright Test Build"
name: "Playwright Test"
video: true
console: true
network: true
commandLog: true

3. Define Test Platforms

Add platform configurations to your lambdatest.yml:

user: "your-lambdatest-username"
accessKey: "your-lambdatest-access-key"
build: "Playwright Test Build"
name: "Playwright Test"
video: true
console: true
network: true
commandLog: true

platforms:
  - platform: "windows 10"
    browserName: "chrome"
    browserVersion: "latest"
  - platform: "macos sonoma"
    browserName: "chrome"
    browserVersion: "latest"
 

4. Run Your Tests

npx playwright-node-sdk playwright test

5. Using Multiple Configuration Files

You can use different configuration files for different environments or test scenarios by setting the LAMBDATEST_YML_FILE environment variable:

# Use a specific configuration file
export LAMBDATEST_YML_FILE="custom-config.yml"
npx playwright-node-sdk playwright test

This allows you to maintain separate configurations for different environments or different test scenarios.

Configuration

Basic Configuration

The SDK uses a lambdatest.yml file for configuration. Here's a complete example:

# LambdaTest Credentials
user: "your-lambdatest-username"
accessKey: "your-lambdatest-access-key"

# Test Configuration
build: "Playwright Test Build"
name: "Playwright Test"
video: true
console: true
network: true
commandLog: true

# Platform Configurations
platforms:
  - platform: "windows 10"
    browserName: "chrome"
    browserVersion: "latest"
    
  - platform: "macos sonoma"
    browserName: "chrome"
    browserVersion: "latest"


## Usage

### Command Line Interface

The SDK provides a command-line interface for running tests:

```bash
# Initialize configuration file
npx playwright-node-sdk init

# Initialize with custom filename
npx playwright-node-sdk init my-config.yml

# Run Playwright tests
npx playwright-node-sdk playwright test

# Use specific configuration file via environment variable
export LAMBDATEST_YML_FILE=custom-config.yml
npx playwright-node-sdk playwright test

Support

About LambdaTest

LambdaTest is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your selenium automation testing to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.

Dependents (0)

Package Sidebar

Install

npm i @lambdatest/playwright-node-sdk

Weekly Downloads

18

Version

1.0.2

License

none

Unpacked Size

1.02 MB

Total Files

14

Last publish

Collaborators

  • lambdatestdev