guanghu/tests/smoke/breadcrumb-icon-size.spec.ts
Guanghu Domestic Migration 9b41d51231
Some checks are pending
Auto-update PR branches / Update open PR branches (push) Waiting to run
CI / Frontend Static Quality Checks (push) Waiting to run
CI / Frontend Tests & Coverage (push) Waiting to run
CI / Rust Tests & Quality Checks (push) Waiting to run
CI / Linux build verification (push) Waiting to run
Deploy docs / Build VitePress site (push) Waiting to run
Deploy docs / Deploy to GitHub Pages (push) Blocked by required conditions
Release (Alpha) / Compute alpha version (push) Waiting to run
Release (Alpha) / Build release artifacts (push) Blocked by required conditions
Release (Alpha) / GitHub Release (alpha) (push) Blocked by required conditions
Release (Alpha) / Update docs and release pages (push) Blocked by required conditions
chore: import sanitized domestic snapshot for REPO-004
Source snapshot: 514ab1975951d94342ea38e64101d5a0f1c51c77
2026-07-17 15:55:28 +08:00

48 lines
1.6 KiB
TypeScript

import { test, expect, type Page } from '@playwright/test'
import { createFixtureVaultCopy, openFixtureVault, removeFixtureVaultCopy } from '../helpers/fixtureVault'
let tempVaultDir: string
async function expectIconSize(buttonName: string, page: Page) {
const icon = page.getByRole('button', { name: buttonName }).locator('svg')
await expect(icon).toBeVisible({ timeout: 5_000 })
const box = await icon.boundingBox()
expect(box?.width).toBeGreaterThanOrEqual(15)
expect(box?.width).toBeLessThanOrEqual(17)
expect(box?.height).toBeGreaterThanOrEqual(15)
expect(box?.height).toBeLessThanOrEqual(17)
}
async function selectAlphaProject(page: Page) {
await expect(async () => {
const note = page
.locator('[data-testid="note-list-container"]')
.getByText('Alpha Project', { exact: true })
.first()
await expect(note).toBeVisible({ timeout: 5_000 })
await note.click({ timeout: 5_000 })
}).toPass({ timeout: 10_000 })
}
test.describe('Breadcrumb action icon size regression', () => {
test.beforeEach(() => {
tempVaultDir = createFixtureVaultCopy()
})
test.afterEach(() => {
removeFixtureVaultCopy(tempVaultDir)
})
test('breadcrumb action icons render at the pre-regression 16px size', async ({ page }) => {
await openFixtureVault(page, tempVaultDir)
await selectAlphaProject(page)
await expect(page.locator('.breadcrumb-bar')).toBeVisible({ timeout: 5_000 })
await expectIconSize('Search within this note', page)
await expectIconSize('Open the raw editor', page)
await expectIconSize('Open the AI panel', page)
await expectIconSize('Archive this note', page)
})
})