tldraw/apps/examples/e2e/tests/test-mobile-style-panel.spec.ts
Taha 7e673b5e37
E2e tests for the toolbar (#2709)
This PR adds some e2e tests for the toolbar.

Fixtures have been set up for the toolbar and style panel, and are
fairly barebones at the moment. Eventually each menu should have a
fixture associated with it, and all tests will use the class defined in
the fixtures file.

### Change Type

- [x] `tests` — Changes to any test code only[^2]

### Release Notes

- Add e2e tests for the toolbar
2024-02-16 14:15:00 +00:00

28 lines
886 B
TypeScript

import { expect } from '@playwright/test'
import { setup } from '../shared-e2e'
import test from './fixtures/fixtures'
test.describe('mobile ui', () => {
test.beforeEach(setup)
test('style panel opens and closes as expected', async ({
isMobile,
page,
toolbar,
stylePanel,
}) => {
test.skip(!isMobile, 'only run on mobile')
await expect(stylePanel.getElement()).toBeHidden()
await toolbar.mobileStylesButton.click()
await expect(stylePanel.getElement()).toBeVisible()
// clicking off the style panel should close it
page.mouse.click(200, 200)
await expect(stylePanel.getElement()).toBeHidden()
})
test('style menu button is disabled for the eraser tool', async ({ isMobile, toolbar }) => {
test.skip(!isMobile, 'only run on mobile')
const { eraser } = toolbar.tools
await eraser.click()
await expect(toolbar.mobileStylesButton).toBeDisabled()
})
})