test: add messaging screen e2e guard (tabs + history render)

Guards the messaging screen (Send/Bulk/History tabs and the message-history
list against mocked data) before decomposing the 1051-line message-history
component.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
isra el
2026-07-11 06:18:25 +03:00
parent f821f480c7
commit e34dd7ac10

39
web/e2e/messaging.spec.ts Normal file
View File

@@ -0,0 +1,39 @@
import { expect, test } from '@playwright/test'
import { authenticate } from './session'
import { mockApi } from './mock-api'
test.describe('messaging (mocked API, no real backend)', () => {
test('renders the messaging screen and its tabs', async ({
page,
context,
}) => {
await authenticate(context)
await mockApi(page)
await page.goto('/dashboard/messaging')
await expect(
page.getByRole('heading', { name: 'Messaging', level: 2 })
).toBeVisible()
// Tab list is present.
await expect(
page.getByRole('tab', { name: 'Send', exact: true })
).toBeVisible()
await expect(page.getByRole('tab', { name: 'History' })).toBeVisible()
})
test('history tab loads mocked messages without crashing', async ({
page,
context,
}) => {
await authenticate(context)
await mockApi(page)
await page.goto('/dashboard/messaging')
await page.getByRole('tab', { name: 'History' }).click()
// Mocked device message body from the fixtures.
await expect(page.getByText('Hello from textbee')).toBeVisible()
// Never fell through to an error boundary.
await expect(page.getByText('This page couldn')).toHaveCount(0)
})
})