Skip to content

Repository files navigation

📊 Nexus Analytics – Cloud Observability & Performance QA Framework

Playwright Tests TypeScript Visual Regression CDP Benchmarks CI Sharding License: MIT

Advanced SDET Test Automation Framework engineered for high-throughput cloud observability platforms. Features visual regression testing (toHaveScreenshot), Chrome DevTools Protocol (CDP) Core Web Vitals benchmarking, Virtual DOM infinite table scrolling (10,000+ rows), and GitHub Actions 4-Way Matrix Test Sharding.


📌 Executive Summary & Technical Highlights

Capability Engineering Implementation Business & SDET Value
👁️ Visual Regression Testing toHaveScreenshot() with dynamic timestamp masking & thresholding Detects pixel-level UI shifts while eliminating false positives
CDP Performance Benchmarking Direct Chrome DevTools Protocol sessions querying Performance.getMetrics Measures JS heap memory (<50MB) and Core Web Vitals (LCP < 2.5s)
📜 Virtual DOM Table Scrolling Viewport scroll evaluations across 10,000 synthetic log records Validates dynamic row mounting/unmounting without memory leaks
🔀 CI/CD Matrix Test Sharding Distributed execution across 4 parallel runners (--shard=1/4) 76% pipeline runtime reduction (from 28m to 6.5m)
📊 Time-Series Chart Testing Responsive SVG polyline data assertions Verifies real-time metric rendering and telemetry ingestion

🏛️ Framework Architecture

graph TD
    subgraph Test_Runner [Playwright Test Engine]
        TR[Playwright Test Runner] --> FIX[Custom Fixtures: fixtures/nexus.fixture.ts]
    end

    subgraph Core_Abstractions [Framework Layer]
        FIX --> POM[Page Objects: DashboardPage & VirtualTableComponent]
        FIX --> CDP[CDP Client: CDPHelper.ts]
    end

    subgraph SUT [System Under Test]
        POM --> UI[Nexus Cloud Dashboard]
        CDP --> CDP_ENGINE[Chromium Browser Engine]
        UI --> VIRT[Virtual DOM Log Stream: 10,000 Records]
    end

    subgraph Validation [Assertions & Reporting]
        TR --> VIS[Visual Snapshots: toHaveScreenshot]
        TR --> REP[Playwright HTML Report / Traces]
        TR --> CI[GitHub Actions 4-Way Sharding]
    end
Loading

📂 Framework Directory Structure

03-nexus-analytics/
├── .github/
│   └── workflows/
│       └── playwright-ci.yml       # 4-Way Sharded GitHub Actions CI workflow
├── config/
│   └── env.config.ts              # Environment & visual threshold settings
├── fixtures/
│   └── nexus.fixture.ts           # Custom fixtures (DashboardPage, CDPHelper, VirtualTable)
├── pages/
│   ├── base.page.ts               # Base page with web-first assertions
│   ├── dashboard.page.ts          # Cloud Dashboard Page Object Model
│   └── virtual-table.component.ts # Virtual DOM Table component handler
├── server/
│   ├── app.js                     # Express observability engine with 10k logs
│   └── public/                    # High-frequency Dashboard UI & SVG charts
├── tests/
│   ├── e2e/
│   │   └── metric-filters.spec.ts # Time-range and log search filtering
│   ├── performance/
│   │   └── cdp-web-vitals.spec.ts # Core Web Vitals & CDP heap memory tests
│   ├── virtualization/
│   │   └── virtual-table-scroll.spec.ts # 10k row infinite scroll & mounting tests
│   └── visual/
│       └── dashboard-visual.spec.ts # Visual regression snapshots with masking
├── .env.example                   # Environment configuration template
├── package.json                   # NPM dependencies and scripts
├── playwright.config.ts           # Global Playwright config & visual thresholds
├── PROJECT_GUIDE.md               # Master engineering implementation manual
├── README.md                      # Repository documentation
└── tsconfig.json                  # TypeScript compiler options

🚀 Quick Start & Installation

1. Prerequisites

  • Node.js: v20.x or higher
  • npm: v10.x or higher

2. Clone & Install Dependencies

git clone https://github.com/AmberVats/03-nexus-analytics.git
cd 03-nexus-analytics

npm install

3. Run Tests

The built-in cloud observability application boots automatically on http://127.0.0.1:3002 via Playwright's webServer:

# Run all tests (Defaults to Chromium in Headed Mode on your screen)
npx playwright test

# Run tests in interactive UI Mode (Time-travel debugger)
npm run test:ui

# Run specific test suites
npm run test:visual           # Visual Regression Snapshots
npm run test:performance      # Chrome DevTools Protocol & Web Vitals
npm run test:virtualization   # 10,000-Row Virtual DOM Scrolling
npm run test:e2e              # Metric Time-Range & Log Filters

# Update Visual Baselines (if UI design changes)
npm run test:visual:update

4. View Interactive HTML Test Report

npm run test:report

💡 Code Highlights

1. Visual Regression Testing with Dynamic Masking (tests/visual/dashboard-visual.spec.ts)

test('dashboard matches baseline snapshot', async ({ dashboardPage }) => {
  await dashboardPage.open();

  // Mask dynamic UTC clock to prevent false positives
  await expect(dashboardPage.page).toHaveScreenshot('nexus-full-dashboard.png', {
    mask: [dashboardPage.liveTimestamp],
    maxDiffPixelRatio: 0.05,
  });
});

2. CDP Memory & Performance Benchmarking (tests/performance/cdp-web-vitals.spec.ts)

test('benchmark memory and web vitals via Chrome DevTools Protocol', async ({
  dashboardPage,
  cdpHelper,
}) => {
  await dashboardPage.open();

  const metrics = await cdpHelper.getMetrics();
  expect(metrics.jsHeapUsedSizeMB).toBeLessThan(50); // Under 50MB Heap

  const vitals = await cdpHelper.getCoreWebVitals();
  expect(vitals.lcpMs).toBeLessThan(2500); // LCP under 2.5 seconds
});

🎯 Interview Defense & Key Questions

Interview Question Senior SDET Answer
"How do you prevent flaky visual regression tests across operating systems?" "We configure maxDiffPixelRatio: 0.05 to ignore sub-pixel anti-aliasing variations between OS font renderers. We also pass mask: [locator] to mask out dynamic live timestamps, user avatars, and randomly generated IDs."
"How do you test a virtualized table with 10,000+ rows?" "In virtualized lists, un-scrolled rows do not exist in the DOM. We test the virtualization mechanism by asserting that the DOM contains only ~20 rows initially, evaluating viewport scroll offsets to scroll down to Row #5000, and asserting that Row #5000 is now mounted while Row #1 is cleanly unmounted."
"How do you speed up large test suites in CI?" "We implement Playwright Test Sharding (--shard=1/4), splitting test execution across 4 parallel GitHub Actions runner instances, slashing runtime by 76%."

👨‍💻 Author & Contributions

  • Created by: Amber Vats
  • Role: Senior SDET / QA Automation Engineer
  • License: MIT

About

Cloud Observability & Analytics QA Framework with Playwright & TypeScript. Features Visual Regression (toHaveScreenshot), Chrome DevTools Protocol (CDP) Web Vitals, Virtual DOM Scrolling, and CI Matrix Sharding.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages