open-index/open-npm huggingface dataset:
npm package: @orieken/saturday-cucumber
Description: Cucumber integration for the Saturday automation framework.
Latest version: 0.1.1

# @orieken/saturday-cucumber

Cucumber.js integration for the Saturday automation framework. This package simplifies the setup of Playwright-based BDD tests by providing pre-configured Hooks, World, and browser management.

## Features

*   **Custom World**: Provides direct access to Playwright `page`, `browser`, and `context` in your step definitions.
*   **Lifecycle Hooks**: Automatic browser launch, context creation, and video/trace recording managed via `BeforeAll`/`AfterAll`/`Before`/`After` hooks.
*   **Report Attachments**: Automatically attaches screenshots and videos to Cucumber reports on failure.

## Installation

```bash
pnpm add @orieken/saturday-cucumber
```

## Usage

### 1. Initialize Hooks

In your `features/support/init.ts` (or similar setup file):

```typescript
import { installSaturdayHooks } from '@orieken/saturday-cucumber';

// Installs Before/After hooks for browser management
installSaturdayHooks();
```

### 2. Use SaturdayWorld in Steps

```typescript
import { Given } from '@cucumber/cucumber';
import { SaturdayWorld } from '@orieken/saturday-cucumber';

Given('I open the homepage', async function(this: SaturdayWorld) {
  // Access Playwright Page object directly
  await this.page.goto('https://example.com');
});
```
npm package: @orieken/saturday-cucumber-indexer
Description: A CLI tool to index Cucumber feature files for the Saturday framework.
Author: Oscar Rieken
Latest version: 0.1.2

Cucumber Indexer (Final Project)

This is a tiny TypeScript CLI that scans `.feature` files and produces a `CucumberIndex` JSON compatible with the Final backend. It can also POST the generated index to the backend.

Install / Build

- cd final/tools/cucumber-indexer
- npm install
- npm run build

Usage

- Generate an index JSON from final/tests/features into final/backend/data:
  - node dist/index.js --features ../../tests/features --suiteId demo-ecommerce --out ../../backend/data/cucumber_index.json

- Optionally POST directly to a running backend:
  - node dist/index.js --features ../../tests/features --suiteId demo-ecommerce --out ../../backend/data/cucumber_index.json --backend http://localhost:8080

CLI Flags

- --features <dir>: Root folder to scan for .feature files. Defaults to final/tests/features based on repo layout.
- --suiteId <string>: Suite identifier to embed in the index. Default: demo-ecommerce.
- --out <path>: Output JSON file. Default: final/backend/data/cucumber_index.json based on repo layout.
- --backend <url>: When provided, the tool will POST the generated index to <url>/api/cucumber/index.

Notes

- The parser is deliberately simple (keyword-based). For robustness, consider swapping in a real Gherkin parser later.
- When running with the local dev cluster (final/local-cluster), start the backend first, then run the indexer with --backend http://localhost:8080 to register the suite.
npm package: @orieken/saturday-k6-redaction-basic
Description: Basic redaction policy for @saturday/playwright-k6-exporter (headers, tokens, passwords).
Latest version: 0.1.2


# @saturday/k6-redaction-basic
Basic redaction policy plugin for `@saturday/playwright-k6-exporter`.

- Detects common secret headers and sensitive body fields.
- Replaces values with `${ENV}` placeholders and returns findings.

## Usage
```ts
import { createDefaultRedactionPolicy } from '@saturday/k6-redaction-basic';
const policy = createDefaultRedactionPolicy({ envPrefix: 'K6_' });
```
npm package: @orieken/saturday-ml-analyzer
Description: ML-powered analysis for test interaction heatmaps
Author: Oscar Rieken
Latest version: 0.0.2

# Saturday ML Analyzer

A machine-learning powered tool that analyzes test execution heatmaps to identify "Cold Spots"—areas of your application that are accessible but have low or zero test coverage.

## Features

- **K-Means Clustering**: Uses `ml-kmeans` to group scattered interaction events into "Hotspots".
- **Cold Spot Detection**: Mathematically calculates which interactable elements are furthest from any known interaction cluster.
- **Coverage Scoring**: Provides a quantitative "Coverage Score" based on interactions vs. opportunities.

## Installation

```bash
pnpm add @orieken/saturday-ml-analyzer
```

## Usage

### CLI

Run the analyzer against a directory containing heatmap JSON data (generated by `@orieken/saturday-playwright-heatmap`).

```bash
node dist/index.js <path-to-heatmap-data>
```

**Example Output:**

```text
Test: User Login (passed)
  Coverage Score: 85.0%
  Hotspots: 3 (Username, Password, Submit)
  Cold Spots: 2
    - a "Forgot Password" 
    - a "Sign Up"
```

### API

You can also use the analyzer programmatically:

```typescript
import { HeatmapAnalyzer } from '@orieken/saturday-ml-analyzer';

const analyzer = new HeatmapAnalyzer();
const result = analyzer.analyze(testData);

console.log(result.coldSpots);
```

## How It Works

### Analysis Workflow

```mermaid
graph LR
    Input[Heatmap JSON] -->|Read| Loader
    Loader -->|Extract| Inter[Interactions (x,y)]
    Loader -->|Extract| Elements[Interactables]
    
    Inter -->|K-Means| Clustering[Identify Hotspots]
    
    Clustering & Elements -->|Distance Calc| Comparator
    
    Comparator -->|Output| ColdSpots[Cold Spots]
    Comparator -->|Output| Score[Coverage %]
```

### Clustering Logic

The analyzer uses a proximity threshold to determine if an element was "tested".

```mermaid
graph TD
    Start --> Check{Distance to Nearest Hotspot < 50px?}
    Check -->|Yes| Tested[Mark as Covered]
    Check -->|No| Cold[Mark as Cold Spot]
    Cold --> Alert[Add to Risk Report]
```
npm package: @orieken/saturday-playwright
Description: Playwright integration for the Saturday automation framework.
Latest version: 0.1.1

# @orieken/saturday-playwright

Playwright integration for the Saturday automation framework.

This package provides a seamless bridge between Playwright's native test runner and the Saturday framework's core architecture by exposing Saturday's management utilities directly as Playwright fixtures.

## Features

- **Saturday Fixtures**: Automatically initializes and injects `siteManager`, `tabManager`, and `consoleLogger` into your Playwright tests.
- **State Cleanup**: Automatically isolates test state by closing open tabs and wiping manager registries after every test run.
- **Enhanced Telemetry on Failure**: If a test fails, this package automatically intercepts the failure and attaches rich context directly to the Playwright report:
  - Text dumps of all browser console logs.
  - Active tab tracking and window state.
  - Site Manager registry state.

## Installation

```bash
pnpm add -D @orieken/saturday-playwright @orieken/saturday-core @playwright/test
```

## Usage

Instead of importing `test` and `expect` from `@playwright/test`, import them from `@orieken/saturday-playwright`.

```typescript
import { test, expect } from '@orieken/saturday-playwright';

test('my automated test', async ({ page, siteManager, tabManager, consoleLogger }) => {
  // Use tab manager to open a new tab
  const newTab = await tabManager.openInNewTab('dashboard', 'https://example.com/dashboard');
  
  // Register a Saturday Core Site Model
  const mySite = new MySiteModel(newTab);
  siteManager.register('mainSite', mySite);

  await mySite.loginFlow.execute();
  await expect(newTab).toHaveTitle(/Dashboard/);

  // You can easily pull console logs explicitly if needed
  const logs = consoleLogger.getLogs();
  console.log(`Intercepted ${logs.length} browser logs`);
});
```

## Composition with Other Plugins

Because `@orieken/saturday-playwright` exports a standard extended `@playwright/test` object, it composes beautifully with other Playwright fixtures like the Saturday Heatmap tracker.

Use Playwright's `mergeTests` utility to combine custom extensions:

```typescript
import { test as base, expect } from '@orieken/saturday-playwright';
import { test as heatmapTest } from '@orieken/saturday-playwright-heatmap';
import { mergeTests } from '@playwright/test';

export const test = mergeTests(base, heatmapTest);

// 'test' now has access to { siteManager, tabManager, consoleLogger, heatmap }
```
npm package: @orieken/saturday-playwright-heatmap
Description: Playwright heatmap generator for test coverage visualization
Author: Oscar Rieken
Latest version: 0.0.2

# Saturday Playwright Heatmap

A Playwright plugin that visualizes test coverage by tracking user interactions (clicks, inputs) and comparing them against all available interactable elements on the page.

## Features

- **Interaction Tracking**: Automatically records `click`, `input`, and `change` events.
- **Interactable Scanning**: Scans the DOM for buttons, links, and inputs to understand what *could* be tested.
- **Visual Heatmaps**: Generates HTML reports overlaying interactions (Red Dots) on top of available elements (Cyan Boxes).

## Installation

```bash
pnpm add @orieken/saturday-playwright-heatmap
```

## Usage

### 1. Register the Fixture

In your test file or a global `fixtures.ts`:

```typescript
import { test as base } from '@playwright/test';
import { test as heatmapTest } from '@orieken/saturday-playwright-heatmap';

export const test = base.extend(heatmapTest);
```

### 2. Run Your Tests

Use the `heatmap` fixture in your tests. No extra code is needed; the fixture auto-injects the tracker.

```typescript
test('user login flow', async ({ page, heatmap }) => {
  await page.goto('/login');
  await page.getByTestId('username').fill('wizard');
  await page.getByTestId('password').fill('secrets');
  await page.getByRole('button', { name: 'Login' }).click();
});
```

### 3. Generate Report

After running tests, generate the visual report:

```bash
node node_modules/@orieken/saturday-playwright-heatmap/dist/reporter.js heatmap-data heatmap-report.html
```

## Architecture

### System Overview

```mermaid
graph TD
    User[Test Engineer] -->|Runs| Playwright[Playwright Test Runner]
    Playwright -->|Injects| Tracker[Tracker Script]
    Playwright -->|Injects| Scanner[Scanner Script]
    
    subgraph Browser Context
        Tracker -->|Listens| Events[Interaction Events]
        Scanner -->|Queries| DOM[Interactable Elements]
    end
    
    Events -->|Collected By| Fixture[Heatmap Fixture]
    DOM -->|Collected By| Fixture
    
    Fixture -->|Writes| JSON[heatmap-data/*.json]
    
    JSON -->|Processed By| Reporter[HTML Reporter]
    Reporter -->|Generates| HTML[heatmap-report.html]
```

### Workflow

```mermaid
sequenceDiagram
    participant Test
    participant Fixture
    participant Browser
    participant FileSystem

    Test->>Fixture: Request Heatmap
    Fixture->>Browser: page.addInitScript(tracker)
    
    Note over Browser: Tracker listens for clicks/inputs
    Test->>Browser: Perform Actions
    
    Test->>Fixture: Test Teardown
    Fixture->>Browser: Evaluate scannerScript
    Browser-->>Fixture: Return Interactables & Events
    
    Fixture->>FileSystem: Write test-result.json
```
npm package: @orieken/saturday-playwright-otel-reporter
Description: OpenTelemetry reporter for Playwright in the Saturday Framework
Author: Oscar Rieken
Latest version: 0.1.4

# @orieken/saturday-playwright-otel-reporter

An OpenTelemetry reporter for Playwright, integrated with the Saturday Framework. It instruments your Playwright tests with distributed tracing and metrics.

## Features

- **Automatic Tracing**: Captures Test, Step, and Hook execution as OTel spans.
- **Hierarchical Trace Context**: Preserves the parent-child relationship of steps and fixtures within a test.
- **Status Reporting**: Accurately maps Playwright test results to OTel Span Status codes (`OK`, `ERROR`).
- **Debugging Tools**: Built-in support for debugging logs and payload inspection.

## Installation

```bash
pnpm add -D @orieken/saturday-playwright-otel-reporter
```

## Configuration

Add the reporter to your `playwright.config.ts`:

```typescript
import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: process.env.ENABLE_OTEL === 'true' 
    ? [['list'], ['@orieken/saturday-playwright-otel-reporter']]
    : [['list']],
  // ...
});
```

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `ENABLE_OTEL` | Set to `true` to activate the reporter | `false` |
| `OTEL_SERVICE_NAME` | Name of the service | `playwright-tests` |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP HTTP Endpoint (Traces) | (required) |
| `OTEL_CUSTOM_CONFIG` | Path to a custom configuration file. If not specified, looks for `playwright-otel.config.mjs` or `playwright-otel.config.js` in the project root. | - |
| `OTEL_SAVE_PAYLOADS` | If `true`, saves the generated OTel spans to `./reports/otel-playwright-spans-<TIMESTAMP>.json` | `false` |
| `OTEL_DEBUG_LOGGING` | Set to `true` for verbose console output during test execution | `false` |


## Custom Configuration

You can define a `playwright-otel.config.mjs` file in your project root to customize attributes:

```javascript
export default {
  resourceAttributes: {
    'service.version': '1.0.0',
    'service.runner': 'playwright'
  },
  // Custom logic for adding attributes to tests
  testAttributes: (test) => {
    return {
      'custom.test.tags': test.tags ? test.tags.map(t => t.tag).join(',') : ''
    };
  }
};
```

## Trace Attributes

The reporter automatically adds the following Resource Attributes:
- `test.reporter`: `playwright`
- `test.browser`: The browser name (if available)

## Metrics

This reporter automatically collects the following metrics:

- `playwright.test.cases` (Counter): Counts the number of executed test cases.
  - Labels: `test.status`, `test.browser`, `test.file`

## Sample Queries (PromQL)

**Total Pass/Fail Count per Browser:**
```promql
sum by (test_status, test_browser) (playwright_test_cases_total)
```

**Success Rate (%):**
```promql
sum(playwright_test_cases_total{test_status="passed"}) / sum(playwright_test_cases_total) * 100
```