From 3be1065d5470b5ea030eeec983f4ac581ac6d3db Mon Sep 17 00:00:00 2001 From: hairyfbot <318164157+hairyfbot@users.noreply.github.com> Date: Sat, 21 Nov 2026 17:55:11 +0800 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=E7=9C=9F=E5=AE=9E=E5=AE=BF?= =?UTF-8?q?=E4=B8=BB=E6=96=AD=E8=A8=80=E5=85=B3=E9=97=AD=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B8=B8=E9=A9=BB=20Tabs=20=E8=A1=8C=E6=9C=80=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=EF=BC=88#991=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-graph 用例在「提交详情」页签上断言面板只有一个关闭按钮、它挂在 Tabs 那一行(tablist 的父行)末尾,切到「差异」后仍在同一行,点击它关闭整块面板。 --- tests/e2e/git-graph.e2e.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/e2e/git-graph.e2e.ts b/tests/e2e/git-graph.e2e.ts index a17a3b09..7d783aa6 100644 --- a/tests/e2e/git-graph.e2e.ts +++ b/tests/e2e/git-graph.e2e.ts @@ -78,6 +78,20 @@ test('read-only Git Graph renders merge history and filters without checkout', a const mergeRow = graph.locator('[data-graph-commit]', { hasText: 'Graph merge' }).first() await expect(mergeRow.getByText('main', { exact: true })).toBeVisible() await page.screenshot({ path: testInfo.outputPath('git-graph.png'), fullPage: true }) + // #991: the pane's exit is ONE control on the tab row — the details tab + // used to have no close button at all, and the diff/content views carried + // theirs BELOW the strip. It now rides the strip row's right end on every + // tab, and clicking it closes the whole pane. + const paneRoot = page.locator('[class*="diffPane"]').first() + const tabRow = paneRoot.locator('[role="tablist"]').first().locator('..') + const closeButton = tabRow.getByRole('button', { name: 'Close preview', exact: true }) + await expect(closeButton).toHaveCount(1) + await paneRoot.getByRole('tab', { name: 'Diff', exact: true }).click() + await expect(tabRow.getByRole('button', { name: 'Close preview', exact: true })).toHaveCount(1) + // …and it is the pane's ONLY one (no second X left in the diff head). + await expect(paneRoot.getByRole('button', { name: 'Close preview', exact: true })).toHaveCount(1) + await closeButton.click() + await expect(paneRoot).toHaveCount(0) const branchFilter = page.locator('[data-git-graph] select').filter({ has: page.locator('option[value="refs/heads/feature"]') }) await branchFilter.selectOption('refs/heads/feature') await expect(graph.getByText('Graph merge', { exact: true })).toHaveCount(0)