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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@playwright-test-runner/core

v1.0.23

Published

Libreria per eseguire test Playwright con ricerca automatica dei test e visualizzazione report

Readme

Playwright Test Runner

Libreria per eseguire test Playwright con ricerca automatica dei test e visualizzazione report.

npm version License: MIT

Caratteristiche

  • Playwright Integrato - Include Playwright, non serve installarlo separatamente
  • Preflight Browser Check - Verifica browser mancanti prima dei test con istruzioni chiare o installazione automatica
  • Ricerca Automatica - Trova automaticamente i file di test nella cartella tests/
  • Report Interattivi - Visualizzazione automatica dei risultati nel browser
  • Report Robusto - Se la porta 9323 e occupata usa automaticamente una porta libera
  • Zero Config - Funziona subito, nessuna configurazione richiesta
  • Setup Guidato - Crea automaticamente la cartella tests se non esiste

Installazione

npm install @playwright-test-runner/core

Durante l'installazione il package esegue un controllo browser Playwright:

  • se i browser sono gia presenti, non fa nulla;
  • se mancano, prova a installarli automaticamente.
  • usa come default PLAYWRIGHT_BROWSERS_PATH=$HOME/Library/Caches/ms-playwright se la variabile non e impostata.
  • crea automaticamente tests/, tests/example.spec.ts e tests/playwright.config.ts.
  • tests/playwright.config.ts e una config locale agnostica del progetto consumer, usata direttamente dal runner.

Se vuoi disattivare questo comportamento:

PLAYWRIGHT_TEST_RUNNER_SKIP_BROWSER_INSTALL=1 npm install @playwright-test-runner/core

Variabili ambiente per config generata:

  • PLAYWRIGHT_BASE_URL (default: http://localhost:3000)
  • PLAYWRIGHT_WEB_SERVER_COMMAND (default: npm run start)

Esempio rapido:

PLAYWRIGHT_BASE_URL=http://localhost:4200 npx playwright-test --ci

Il runner usa la config locale del consumer:

  • tests/playwright.config.ts

Comandi Disponibili

  • npx playwright-test - Esegue i test (con preflight browser) e apre il report
  • npx playwright-test --no-open-report - Esegue test senza avviare server report
  • npx playwright-test --report-only-on-fail - Apre il report solo se i test falliscono
  • npx playwright-test --ci - Modalita CI: esegue test e termina senza processi appesi
  • npx playwright-test --install-browsers - Installa browser mancanti prima dell'esecuzione
  • npx playwright-test-install - Installa i browser Playwright dal package padre
  • npx playwright-report - Mostra solo il report (senza rieseguire i test)
  • npx playwright-report --port 9400 - Imposta una porta preferita (con fallback automatico se occupata)

Utilizzo

Eseguire i test

npx playwright-test

Questo comando:

  1. Cerca i file *.spec.ts / *.test.ts nella cartella tests/
  2. Verifica che i browser Playwright siano disponibili
  3. Esegue tutti i test con Playwright
  4. Apre automaticamente il report nel browser (se non in CI e senza flag di disattivazione)

Se i browser non sono installati, il comando mostra un errore chiaro con suggerimento:

npx playwright install

Oppure puo installarli automaticamente:

npx playwright-test --install-browsers

Oppure con comando dedicato:

npx playwright-test-install

Modalita report

# Esegue test ma NON apre il server report
npx playwright-test --no-open-report

# Apre report solo se i test falliscono
npx playwright-test --report-only-on-fail

# Modalita CI: non apre report server e termina pulito
npx playwright-test --ci

In ogni modalita report, se la porta 9323 e occupata viene usata una porta libera automaticamente.

Se la cartella tests/ non esiste, il comando ti chiederà se vuoi crearla automaticamente con un file di test di esempio.

Visualizzare il report

npx playwright-report

Apre il report HTML dell'ultima esecuzione su http://localhost:<porta>. Se 9323 e gia in uso, viene selezionata automaticamente una porta disponibile.

# Usa una porta preferita diversa
npx playwright-report --port 9400

Opzioni

# Specifica una cartella test diversa
npx playwright-test --tests-dir e2e

# Specifica la root del progetto
npx playwright-test --project /path/to/project

# Non aprire il report
npx playwright-test --no-open-report

# Apri report solo in caso di failure
npx playwright-test --report-only-on-fail

# Installa browser mancanti automaticamente
npx playwright-test --install-browsers

# Comando dedicato install browser
npx playwright-test-install

# Esecuzione CI (uscita pulita, nessun server in ascolto)
npx playwright-test --ci

# Mostra help
npx playwright-test --help

Setup Progetto

Struttura

your-project/
├── tests/                  # Cartella dei test
│   ├── example.spec.ts
│   ├── login.spec.ts
│   └── api/
│       └── users.test.ts
├── package.json
└── playwright-report/      # Generato dopo i test

Esempio di test

File tests/example.spec.ts:

import { test, expect } from '@playwright/test';

test('homepage has title', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  await expect(page).toHaveTitle(/Playwright/);
});

test('health endpoint responds', async ({ request }) => {
  const response = await request.get('/health');
  expect(response.ok()).toBeTruthy();
});

Uso Programmatico

import { PlaywrightTestRunner } from '@playwright-test-runner/core';

const runner = new PlaywrightTestRunner({
  projectRoot: process.cwd(),
  testsDir: 'tests'
});

// Ottieni lista dei test
const testFiles = await runner.getTestFiles();
console.log('Test trovati:', testFiles);

// Esegui i test
const result = await runner.runTests({
  reporter: 'html',
  headed: false,
  installBrowsersIfMissing: true
});

if (result.success) {
  // Mostra report
  const { url } = await runner.showReport();
  console.log('Report disponibile su:', url);
}

// Cleanup
runner.stopReportServer();

Script package.json Consigliati

{
  "scripts": {
    "test": "playwright-test",
    "test:report": "playwright-report",
    "test:ci": "playwright-test --ci",
    "test:local": "playwright-test --report-only-on-fail"
  }
}

CI/CD (GitHub Actions)

name: E2E Tests
on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18

      - name: Install
        run: npm install

      - name: Install browsers
        run: npx playwright install --with-deps chromium

      - name: Run tests
        run: npx playwright-test --ci

      - name: Upload report
        if: always()
        uses: actions/upload-artifact@v3
        with:
          name: playwright-report
          path: playwright-report/

Requisiti

  • Node.js >= 18
  • Playwright - Incluso nella libreria

License

MIT