diff --git a/packages/playwright/src/isomorphic/testTree.ts b/packages/playwright/src/isomorphic/testTree.ts index 7a9ddc3668141..c57138b6cc371 100644 --- a/packages/playwright/src/isomorphic/testTree.ts +++ b/packages/playwright/src/isomorphic/testTree.ts @@ -79,6 +79,12 @@ export class TestTree { const visitSuite = (project: reporterTypes.FullProject, parentSuite: reporterTypes.Suite, parentGroup: GroupItem) => { for (const suite of parentSuite.suites) { + if (!suite.title) { + // Flatten anonymous describes. + visitSuite(project, suite, parentGroup); + continue; + } + const title = suite.title || ''; let group = parentGroup.children.find(item => item.kind === 'group' && item.title === title) as GroupItem | undefined; if (!group) { diff --git a/tests/playwright-test/ui-mode-test-tree.spec.ts b/tests/playwright-test/ui-mode-test-tree.spec.ts index 81d8fa764a102..69b2e1048e832 100644 --- a/tests/playwright-test/ui-mode-test-tree.spec.ts +++ b/tests/playwright-test/ui-mode-test-tree.spec.ts @@ -315,28 +315,23 @@ test('should list parametrized tests', async ({ runUITest }) => { await page.getByText('cookies').click(); await page.keyboard.press('ArrowRight'); - await page.getByText('').click(); - await page.keyboard.press('ArrowRight'); await expect.poll(dumpTestTree(page)).toBe(` ▼ ◯ a.test.ts - ▼ ◯ cookies - ▼ ◯ <= - ◯ test FR - ◯ test DE - ◯ test LT + ▼ ◯ cookies <= + ◯ test FR + ◯ test DE + ◯ test LT `); await expect(page.getByTestId('test-tree')).toMatchAriaSnapshot(` - tree: - treeitem "[icon-circle-outline] a.test.ts" [expanded]: - group: - - treeitem "[icon-circle-outline] cookies" [expanded]: + - treeitem "[icon-circle-outline] cookies" [expanded] [selected]: - group: - - treeitem "[icon-circle-outline] " [expanded] [selected]: - - group: - - treeitem "[icon-circle-outline] test FR" - - treeitem "[icon-circle-outline] test DE" - - treeitem "[icon-circle-outline] test LT" + - treeitem "[icon-circle-outline] test FR" + - treeitem "[icon-circle-outline] test DE" + - treeitem "[icon-circle-outline] test LT" `); });