From e34dd7ac104f43af1e41228cfca3ac6030038afb Mon Sep 17 00:00:00 2001 From: isra el Date: Sat, 11 Jul 2026 06:18:25 +0300 Subject: [PATCH] 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) --- web/e2e/messaging.spec.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 web/e2e/messaging.spec.ts diff --git a/web/e2e/messaging.spec.ts b/web/e2e/messaging.spec.ts new file mode 100644 index 0000000..c233658 --- /dev/null +++ b/web/e2e/messaging.spec.ts @@ -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) + }) +})