mirror of
https://github.com/vernu/textbee.git
synced 2026-07-31 01:17:52 -04:00
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:
39
web/e2e/messaging.spec.ts
Normal file
39
web/e2e/messaging.spec.ts
Normal 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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user