稳定打印验收的视口切换检查
等待桌面与窄屏布局收敛后检查横向溢出,保留对打印入口和完整页面的实际断言。
| | |
| | | const button = page.getByRole('button', { name: '打印 / 另存 PDF', exact: true }) |
| | | await button.scrollIntoViewIfNeeded() |
| | | await expect(button).toBeInViewport() |
| | | expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true) |
| | | await expect.poll(() => page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true) |
| | | await page.screenshot({ path: `tests/e2e/.artifacts/compare-print-entry-v${version}-${width}.png`, fullPage: true }) |
| | | } |
| | | const popupPromise = page.waitForEvent('popup') |