Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
PreviousJSON Snapshots
NextMobile QR Code Sync
Sandbox State & Health

Headless CI/CD Sandboxing with Custom Identity

Execute dozens of parallel automated test jobs without state collisions, database locks, or cross-test data pollution. Pass a unique X-Playground-Identity header to give every automated runner its own isolated memory sandbox.

CI/CD Parallel Test Runner Isolation Architecture
DevOps Concurrency
Playground API Parallel Test Runner Isolation with Custom Identity Headers Workflow Diagram
Click to expand full architecture
Sharded matrix runners (Playwright / Cypress) execute concurrently with zero database locks or cross-test mutations.Interactive High-Resolution Flowchart
1Sharded CI

Parallel Runner Sharding

CI matrices spawn parallel runner workers (e.g. GitHub Actions matrix shards 1-4).

2X-Playground-Identity

Identity Header Routing

Pass X-Playground-Identity to guarantee private isolated sandboxes for each job.

3Zero Flakiness

Deterministic Tear Down

Call DELETE /session/reset before each suite for instantaneous baseline recovery.

Shared Database vs. Virtual Session Sandboxing

Traditional Shared Staging DB

  • Flaky Collisions: Worker A deletes item #1 while Worker B is asserting its existence.
  • Serialized Runs: Tests must run sequentially or spend minutes rebuilding databases.
  • High Hosting Costs: Requires spinning up dedicated Docker containers per CI branch.

Playground Virtual Overlays

  • Zero Cross-Talk: Each worker gets its own isolated memory overlay on top of pristine data.
  • Instant Reset: Call DELETE /session/reset to wipe mutations in 10ms.
  • Infinite Parallelism: Scale to 100+ concurrent matrix runners with zero setup.

Configuring Test Runners (Playwright, Cypress, Vitest)

Inject the X-Playground-Identity header into your test configuration:

playwright-config.ts
1
// playwright.config.ts
2
import { defineConfig } from '@playwright/test';
3
4
export default defineConfig({
5
testDir: './e2e',
6
fullyParallel: true, // Run test files in parallel
7
workers: process.env.CI ? 4 : undefined,
8
use: {
9
baseURL: 'http://localhost:3000',
10
extraHTTPHeaders: {
11
// Each worker gets a dedicated, isolated sandbox identity!
12
'X-Playground-Identity': ci-worker-${process.env.TEST_WORKER_INDEX || '0'},
13
},
14
},
15
});
16
17
// e2e/posts.spec.ts
18
import { test, expect } from '@playwright/test';
19
20
test.describe('Blog CRUD Flow', () => {
21
// Reset sandbox before each test to guarantee clean baseline
22
test.beforeEach(async ({ request }) => {
23
await request.delete('https://playground.nileslabs.com/api/v1/session/reset', {
24
headers: {
25
'X-Playground-Identity': ci-worker-${process.env.TEST_WORKER_INDEX || '0'},
26
},
27
});
28
});
29
30
test('creates and verifies new post', async ({ page }) => {
31
await page.goto('/posts/new');
32
await page.fill('input[name="title"]', 'Automated E2E Post');
33
await page.click('button[type="submit"]');
34
await expect(page.locator('text=Automated E2E Post')).toBeVisible();
35
});
36
});

GitHub Actions Parallel Sharding Workflow

Distribute end-to-end tests across multiple cloud runners simultaneously:

.github/workflows/e2e-matrix.yml
1
# .github/workflows/e2e-matrix.yml
2
name: Parallel E2E Tests
3
on: [push, pull_request]
4
5
jobs:
6
e2e:
7
runs-on: ubuntu-latest
8
strategy:
9
fail-fast: false
10
matrix:
11
shard: [1, 2, 3, 4] # 4 parallel jobs
12
steps:
13
- uses: actions/checkout@v4
14
- uses: actions/setup-node@v4
15
with:
16
node-version: 20
17
18
- name: Install dependencies
19
run: npm ci
20
21
- name: Run Playwright with Isolated Session Identity
22
env:
23
# Unique identity combining run ID and matrix shard
24
PLAYGROUND_IDENTITY: github-${{ github.run_id }}-shard-${{ matrix.shard }}
25
run: npx playwright test --shard=${{ matrix.shard }}/4

Testing on mobile devices?

Scan a QR code to sync your active desktop test session directly to iOS or Android browsers.

View Mobile QR Sync Guide