71 lines
2.7 KiB
Markdown
71 lines
2.7 KiB
Markdown
# 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: verify_stress.spec.js >> Stress test: Virtual List should handle 10,000 items with dynamic height
|
|
- Location: test/verify_stress.spec.js:3:1
|
|
|
|
# Error details
|
|
|
|
```
|
|
Test timeout of 60000ms exceeded.
|
|
```
|
|
|
|
```
|
|
Error: page.waitForFunction: Test timeout of 60000ms exceeded.
|
|
```
|
|
|
|
# Page snapshot
|
|
|
|
```yaml
|
|
- generic [ref=e2]:
|
|
- heading "1. Standard List (Normal)" [level=5] [ref=e4]
|
|
- 'heading "2. Group List (Mode: Group)" [level=5] [ref=e7]'
|
|
- 'heading "3. Tree List (Mode: Tree + Collapsible)" [level=5] [ref=e10]'
|
|
- heading "4. FAST Virtual List (10,000 Items + Dynamic Height)" [level=5] [ref=e13]
|
|
```
|
|
|
|
# Test source
|
|
|
|
```ts
|
|
1 | import { test, expect } from '@playwright/test';
|
|
2 |
|
|
3 | test('Stress test: Virtual List should handle 10,000 items with dynamic height', async ({ page }) => {
|
|
4 | test.setTimeout(60000);
|
|
5 | page.on('console', msg => console.log('BROWSER LOG:', msg.text()));
|
|
6 |
|
|
7 | await page.goto('http://localhost:8082/test/list_test.html');
|
|
8 |
|
|
9 | const listFast = page.locator('#listFast');
|
|
10 | await expect(listFast).toBeVisible();
|
|
> 11 | await page.waitForFunction(() => document.querySelectorAll('#listFast .list-group-item').length > 0);
|
|
| ^ Error: page.waitForFunction: Test timeout of 60000ms exceeded.
|
|
12 |
|
|
13 | // Check initial state
|
|
14 | const scrollTop = await listFast.evaluate(e => e.scrollTop);
|
|
15 | const scrollHeight = await listFast.evaluate(e => e.scrollHeight);
|
|
16 | const clientHeight = await listFast.evaluate(e => e.clientHeight);
|
|
17 | console.log(`Initial: scrollTop=${scrollTop}, scrollHeight=${scrollHeight}, clientHeight=${clientHeight}`);
|
|
18 |
|
|
19 | // Attach event listener to see if scroll fires
|
|
20 | await listFast.evaluate(e => {
|
|
21 | e.addEventListener('scroll', () => console.log('SCROLL EVENT FIRED! new scrollTop:', e.scrollTop));
|
|
22 | });
|
|
23 |
|
|
24 | // Scroll to the very end
|
|
25 | await listFast.evaluate(e => e.scrollTop = e.scrollHeight);
|
|
26 | await page.waitForTimeout(1000);
|
|
27 |
|
|
28 | const finalScrollTop = await listFast.evaluate(e => e.scrollTop);
|
|
29 | console.log(`Final: scrollTop=${finalScrollTop}`);
|
|
30 |
|
|
31 | const lastItemText = await listFast.locator('.list-group-item').last().textContent();
|
|
32 | console.log('Last rendered item text:', lastItemText);
|
|
33 | expect(lastItemText).toContain('Virtual Item 10000');
|
|
34 | });
|
|
35 |
|
|
``` |