Skip to content

Commit

Permalink
algin e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Mar 7, 2025
1 parent fa2a0ee commit ea5d72a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/dnb-design-system-portal/src/e2e/pageScroll.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ test.describe('Page Scroll', () => {
expect(scrollY).toBeGreaterThanOrEqual(2000)
})

test('should highlight a linked hash element', async ({ page }) => {
test('should scroll to linked hash element', async ({ page }) => {
expect(
await page.evaluate(() => window.scrollY),
).toBeGreaterThanOrEqual(0)

const anchorElement = (
await page.locator('main .dnb-ul li a').all()
).at(7)
Expand All @@ -37,7 +41,8 @@ test.describe('Page Scroll', () => {
'/contribute/getting-started/#style-dependencies',
)

const headingElement = page.locator('.dnb-heading.focus')
await expect(headingElement).toHaveText('#Style dependencies')
expect(
await page.evaluate(() => window.scrollY),
).toBeGreaterThanOrEqual(2000)
})
})

0 comments on commit ea5d72a

Please sign in to comment.