1import { test, expect } from '@playwright/test';
2
3test.describe('Shelley Smoke Tests', () => {
4 test('page loads successfully', async ({ page }) => {
5 await page.goto('/');
6 await page.waitForLoadState('domcontentloaded');
7
8 // Just verify the page loads with a title
9 const title = await page.title();
10 expect(title).toBe('Shelley');
11 });
12
13 test('can find message input with proper aria label', async ({ page }) => {
14 await page.goto('/');
15 await page.waitForLoadState('domcontentloaded');
16
17 // Find the textarea using improved selectors
18 const messageInput = page.getByTestId('message-input');
19 await expect(messageInput).toBeVisible();
20
21 // Verify it has proper aria labeling
22 await expect(messageInput).toHaveAttribute('aria-label', 'Message input');
23 });
24
25 test('can find send button with proper aria label', async ({ page }) => {
26 await page.goto('/');
27 await page.waitForLoadState('domcontentloaded');
28
29 // Find the send button using improved selectors
30 const sendButton = page.getByTestId('send-button');
31 await expect(sendButton).toBeVisible();
32
33 // Verify it has proper aria labeling
34 await expect(sendButton).toHaveAttribute('aria-label', 'Send message');
35 });
36
37 test('message input is initially empty and focused', async ({ page }) => {
38 await page.goto('/');
39 await page.waitForLoadState('domcontentloaded');
40
41 const messageInput = page.getByTestId('message-input');
42 await expect(messageInput).toBeVisible();
43
44 // Verify input is empty initially
45 await expect(messageInput).toHaveValue('');
46
47 // Verify placeholder text is present
48 await expect(messageInput).toHaveAttribute('placeholder', /Type your message/);
49 });
50
51 test('send button is disabled when input is empty', async ({ page }) => {
52 await page.goto('/');
53 await page.waitForLoadState('domcontentloaded');
54
55 const sendButton = page.getByTestId('send-button');
56
57 // Button should be disabled initially
58 await expect(sendButton).toBeDisabled();
59 });
60
61 test('send button becomes enabled when text is entered', async ({ page }) => {
62 await page.goto('/');
63 await page.waitForLoadState('domcontentloaded');
64
65 const messageInput = page.getByTestId('message-input');
66 const sendButton = page.getByTestId('send-button');
67
68 // Enter some text
69 await messageInput.fill('test message');
70
71 // Button should now be enabled
72 await expect(sendButton).toBeEnabled();
73 });
74});