# Instructions - Following Playwright test failed. - Explain why, be concise, respect Playwright best practices. - Provide a snippet of code with the fix, if possible. # Test info - Name: all.spec.js >> modular unit tests and benchmark - Location: test/all.spec.js:5:1 # Error details ``` Error: expect(received).toBe(expected) // Object.is equality Expected: "passed" Received: "failed" ``` # Test source ```ts 1 | import { test, expect } from '@playwright/test'; 2 | import fs from 'fs'; 3 | import path from 'path'; 4 | 5 | test('modular unit tests and benchmark', async ({ page }) => { 6 | page.on('console', msg => console.log('BROWSER LOG:', msg.text())); 7 | await page.goto('http://localhost:8081/test/index.html'); 8 | 9 | await page.waitForFunction(() => window.testStatus !== undefined, { timeout: 10000 }); 10 | const status = await page.evaluate(() => window.testStatus); > 11 | expect(status).toBe('passed'); | ^ Error: expect(received).toBe(expected) // Object.is equality 12 | 13 | // Read benchmarks from TEST.md 14 | const testMd = fs.readFileSync(path.join(process.cwd(), 'TEST.md'), 'utf-8'); 15 | const getBench = (name) => { 16 | const match = testMd.match(new RegExp(`\\*\\*${name}\\*\\*\\s*\\|\\s*([\\d.]+)`)); 17 | return match ? parseFloat(match[1]) : null; 18 | }; 19 | const baseInitial = getBench('首次渲染 \\(1000 items\\)'); 20 | const baseUpdate = getBench('浅更新 \\(Shallow Update\\)'); 21 | 22 | // Benchmark: Large list rendering 23 | const renderTime = await page.evaluate(async () => { 24 | const start = performance.now(); 25 | document.body.innerHTML = ` 26 |