Perf Scripts & Tools
This directory contains utility scripts for development, testing, and debugging the Perf application.
MultiGraph Monkey Test
A stress-testing tool for the MultiGraph UI (/m/) that automates user interactions to find bugs, crashes, and regressions.
Files
multigraph_monkey_test.js: The core test logic. It's a standalone JavaScript file designed to run inside the browser context.run_monkey_test.js: A Node.js runner that launches Chrome (via Puppeteer), handles Google Login, and injects the monkey test script automatically.
How to Run
Option 1: Automated Runner (Recommended)
Use the provided runner to launch a headful Chrome instance and run the test automatically.
# From the repository root
node perf/scripts/run_monkey_test.js
Configuration:
- Headless Mode:
HEADLESS=true node perf/scripts/run_monkey_test.js (Default: false to allow login). - Chrome Path: The script automatically detects Chrome at
/usr/bin/google-chrome. Set CHROME_BIN env var to override.
Option 2: Manual (DevTools Snippet)
- Open Chrome DevTools (F12).
- Go to Sources > Snippets.
- Create a new snippet and paste the content of
multigraph_monkey_test.js. - Right-click the snippet and select Run.
Option 3: Tampermonkey (Browser Extension)
- Install the Tampermonkey extension.
- Create a new script and paste the content of
multigraph_monkey_test.js. - Navigate to any MultiGraph page (
https://chrome-perf.corp.goog/m/). - The script will load automatically (check console for “SUPER MONKEY” logs).
What it Tests
The monkey test performs the following actions:
- Dynamic Discovery: Drills down through filter options to find a dataset with ~50 traces.
- Graph Rendering: Verifies graphs are drawn and layout is valid.
- URL State: Checks if URL parameters match the current selection.
- Split/Unsplit: Enables “Split by” mode and verifies graph multiplication.
- Trace Manipulation: Removes/Adds traces and checks graph count.
- Sidebar Sync: Verifies sidebar rows match displayed traces.
- Overflow: Triggers “Too many traces” warning and verifies recovery.
- Pagination: Iterates through all pages of a large dataset.
- Subset Recovery: Restores state after overflow test.
- Pagination Stress: Backtracks to find a high-cardinality field and iterates through pages.
- Chrome Internal Scenario: (Env specific) Tests Speedometer3 split view.
- Load All Charts: Verifies functionality of the “Load All” button for large datasets.
- Primary Checkbox: Verifies splitting works when “Primary” filter is active.
- Select All Sync: Verifies “Select All” checkbox state syncs with manual item selection.