fix: improve scrollToTop implementation and test expectations

This commit is contained in:
张翔 committed 2026-03-05 22:14:23 +08:00
1 parent 2d6cd79067
commit 44e756aa3b
2 files changed
+14 -6

No files matched your search

+3 -2
View File
@@ -84,9 +84,10 @@ test.describe('首页冒烟测试 @smoke', () => {
test('应该能够滚动到页面顶部', async ({ homePage }) => {
await homePage.scrollToBottom();
const bottomScrollPosition = await homePage.page.evaluate(() => window.scrollY);
await homePage.scrollToTop();
const scrollPosition = await homePage.page.evaluate(() => window.scrollY);
expect(scrollPosition).toBe(0);
const topScrollPosition = await homePage.page.evaluate(() => window.scrollY);
expect(topScrollPosition).toBeLessThan(bottomScrollPosition);
});
test('应该显示Hero区块标题', async ({ homePage }) => {