-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Add E2E tests for toolbar zoom controls
- Loading branch information
Showing
2 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/') | ||
const cookieButton = page.getByRole('button', { | ||
name: 'Accept All Cookies', | ||
}) | ||
await cookieButton.click({ timeout: 1000, force: true }).catch(() => {}) | ||
}) | ||
|
||
test('Desktop toolbar should be visible', async ({ page }) => { | ||
const toolbar = page.locator('div[role="toolbar"][class*="DesktopToolbar"]') | ||
await expect(toolbar).toBeVisible() | ||
}) | ||
|
||
test('Zoom in button should increase zoom level', async ({ page }) => { | ||
const toolbar = page.locator('div[role="toolbar"][class*="DesktopToolbar"]') | ||
const zoomLevelText = toolbar.locator('span[class*="zoomLevelText"]') | ||
|
||
const zoomLevelBefore = await zoomLevelText.textContent() | ||
|
||
const zoomInButton = toolbar.getByTestId('zoom-in-button') | ||
await zoomInButton.click() | ||
|
||
const zoomLevelAfter = await zoomLevelText.textContent() | ||
expect(Number.parseInt(zoomLevelBefore)).toBeLessThan( | ||
Number.parseInt(zoomLevelAfter), | ||
) | ||
}) | ||
|
||
test('Zoom out button should decrease zoom level', async ({ page }) => { | ||
const toolbar = page.locator('div[role="toolbar"][class*="DesktopToolbar"]') | ||
const zoomLevelText = toolbar.locator('span[class*="zoomLevelText"]') | ||
|
||
const zoomLevelBefore = await zoomLevelText.textContent() | ||
|
||
const zoomOutButton = toolbar.getByTestId('zoom-out-button') | ||
await zoomOutButton.click() | ||
|
||
const zoomLevelAfter = await zoomLevelText.textContent() | ||
expect(Number.parseInt(zoomLevelBefore)).toBeGreaterThan( | ||
Number.parseInt(zoomLevelAfter), | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters