Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(html-reporter): show the remaining test count in the speedboard "Show more" button (#42856)
Ashraf Ali724115f51426
diff --git a/packages/html-reporter/src/speedboard.tsx b/packages/html-reporter/src/speedboard.tsxindex f1537df40d..376c3abfd1 100644--- a/packages/html-reporter/src/speedboard.tsx+++ b/packages/html-reporter/src/speedboard.tsx@@ -43,7 +43,7 @@ export function SlowestTests({ report, tests }: { report: LoadedReport, tests: Tlength < tests.length? <button className='link-badge fullwidth-link' style={{ padding: '8px 5px' }} onClick={() => setLength(l => l + 50)}>{icons.downArrow()}- Show 50 more+ Show {Math.min(50, tests.length - length)} more</button>: undefined}diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.tsindex b9575303b8..3853d0e174 100644--- a/tests/playwright-test/reporter-html.spec.ts+++ b/tests/playwright-test/reporter-html.spec.ts@@ -95,6 +95,30 @@ for (const useIntermediateMergeReport of [true, false] as const) {await expect(page.getByTestId('metadata-view')).not.toBeVisible();});+ test('speedboard "Show more" button should show the remaining test count', async ({ runInlineTest, showReport, page }) => {+ const tests: string[] = [];+ for (let i = 1; i <= 57; ++i)+ tests.push(`test('test ${String(i).padStart(2, '0')}', async () => { await new Promise(f => setTimeout(f, ${i})); });`);+ await runInlineTest({+ 'a.spec.ts': `+ import { test } from '@playwright/test';+ ${tests.join('\n ')}+ `,+ }, { reporter: 'dot,html' }, { PLAYWRIGHT_HTML_OPEN: 'never' });++ await showReport();+ await page.getByRole('link', { name: 'Speedboard' }).click();++ // 57 tests with the initial page size of 50 → exactly 7 remain.+ const button = page.locator('button', { hasText: /Show \d+ more/ });+ await expect(button).toHaveCount(1);+ await expect(button).toContainText('Show 7 more');++ // Revealing the remaining tests removes the button.+ await button.click();+ await expect(page.locator('button', { hasText: /Show \d+ more/ })).toHaveCount(0);+ });+test('should allow navigating to testId=test.id', async ({ runInlineTest, page, showReport }) => {const result = await runInlineTest({'a.test.js': `