test(sw): stabilize Firefox hover, pixel and timing checks
- hover-stability-firefox: instant scroll and state waits instead of a fixed 60ms delay (smooth scroll in preview). - integrated-visual, viewer-regression, theme-inheritance: deterministic Chromium raster flags, animations held at time 0, layout settle wait, integer instant scroll of inner panels; tolerance stays 0. - text-weight: wait for the Viewer More panel instead of a fixed 200ms and fix the failure report.
This commit is contained in:
1 parent
1ffff67991
commit
af7f98d66b
5 files changed
+49
-14
No files matched your search
@@ -14,7 +14,7 @@ const root = path.resolve('storybook-static'), mime = { '.html': 'text/html', '.
|
||||
const server = http.createServer(async (req, res) => { try { const p = new URL(req.url, 'http://localhost').pathname, file = path.resolve(root, '.' + decodeURIComponent(p === '/' ? '/index.html' : p)); res.setHeader('Content-Type', mime[path.extname(file)] ?? 'application/octet-stream'); res.end(await readFile(file)) } catch { res.writeHead(404).end() } })
|
||||
await new Promise(r => server.listen(0, '127.0.0.1', r)); const base = `http://127.0.0.1:${server.address().port}`
|
||||
const browser = await chromium.launch({ headless: true, executablePath: process.env.SW_CHROME_PATH ?? 'C:/Program Files/Google/Chrome/Application/chrome.exe' })
|
||||
const checks = []; const check = (n, ok, d) => { checks.push({ n, ok, d }); console.log(ok ? 'PASS' : 'FAIL', n, ok ? '' : JSON.stringify(d).slice(0, 500)) }
|
||||
const checks = []; const check = (n, ok, d) => { checks.push({ n, ok, d }); console.log(ok ? 'PASS' : 'FAIL', n, ok ? '' : String(JSON.stringify(d)).slice(0, 500)) }
|
||||
const report = {}
|
||||
let errors = []
|
||||
const page = await browser.newPage({ viewport: { width: 1920, height: 1100 } })
|
||||
@@ -125,8 +125,11 @@ for (const t of ['파일 열기', '레이어']) {
|
||||
const tab = vh.locator('.hm-sw-viewer-header__tab', { hasText: 'Layout' }).first()
|
||||
await stableOnHover('Viewer Layout tab', tab, tab)
|
||||
// More stays: narrow header shows the More button, it opens and lists the moved items.
|
||||
await vh.evaluate(e => { e.style.width = '700px' }); await page.waitForTimeout(200)
|
||||
await vh.evaluate(e => { e.style.width = '700px' })
|
||||
const more = vh.getByRole('button', { name: /추가 도구/ })
|
||||
// 2026-10-20: the header re-measures through a ResizeObserver; wait for More instead of a fixed 200ms (the check below
|
||||
// still fails when it never appears). The fixed wait failed intermittently on the same build.
|
||||
await more.waitFor({ state: 'visible', timeout: 3000 }).catch(() => {})
|
||||
check('Viewer: More button shown at a narrow width', await more.count() === 1 && await more.isVisible())
|
||||
await more.click(); await page.waitForTimeout(200)
|
||||
const moreItems = await page.locator('.hm-sw-viewer-menu [role="menuitem"], .hm-sw-viewer-menu [role="menuitemradio"], .hm-sw-viewer-menu [role="menuitemcheckbox"]').count()
|
||||
|
||||
Reference in new issue
Block a user