mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-28 13:32:23 +00:00
test(e2e): update composer selectors for new placeholder + voice button (#3206)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* needs:
|
||||
*
|
||||
* - `button[title="New thread"]` — icon-only button, no text
|
||||
* - `textarea[placeholder="Type a message..."]` — React-controlled
|
||||
* - `textarea[placeholder="How can I help you today?"]` — React-controlled
|
||||
* input that should be driven through WebDriver so React observes
|
||||
* the same input events a user would produce
|
||||
* - `button[aria-label="Send message"]` — icon-only button
|
||||
@@ -39,7 +39,7 @@ export async function clickByTitle(title: string, timeoutMs = 6_000): Promise<bo
|
||||
return false;
|
||||
}
|
||||
|
||||
const COMPOSER_SELECTOR = 'textarea[placeholder="Type a message..."]';
|
||||
const COMPOSER_SELECTOR = 'textarea[placeholder="How can I help you today?"]';
|
||||
|
||||
/** Type into the chat composer through WebDriver so React's controlled
|
||||
* input state and the DOM stay in sync. */
|
||||
|
||||
@@ -162,7 +162,7 @@ describe('Chat harness — mid-stream cancel', () => {
|
||||
// The textarea must be re-enabled.
|
||||
const composerEnabled = await browser.execute(() => {
|
||||
const ta = document.querySelector(
|
||||
'textarea[placeholder="Type a message..."]'
|
||||
'textarea[placeholder="How can I help you today?"]'
|
||||
) as HTMLTextAreaElement | null;
|
||||
return !!ta && !ta.disabled;
|
||||
});
|
||||
|
||||
@@ -112,7 +112,7 @@ describe('Chat harness — send + stream', () => {
|
||||
'button[aria-label="Send message"]'
|
||||
) as HTMLButtonElement;
|
||||
const ta = document.querySelector(
|
||||
'textarea[placeholder*="Type a message"]'
|
||||
'textarea[placeholder*="How can I help"]'
|
||||
) as HTMLTextAreaElement;
|
||||
return {
|
||||
btnExists: !!btn,
|
||||
|
||||
@@ -153,7 +153,7 @@ describe('Chat tool-error recovery', () => {
|
||||
'button[aria-label="Send message"]'
|
||||
) as HTMLButtonElement | null;
|
||||
const ta = document.querySelector(
|
||||
'textarea[placeholder="Type a message..."]'
|
||||
'textarea[placeholder="How can I help you today?"]'
|
||||
) as HTMLTextAreaElement | null;
|
||||
return (btn !== null && !btn.disabled) || (ta !== null && !ta.disabled);
|
||||
});
|
||||
|
||||
@@ -86,7 +86,7 @@ async function navigateChatAndSend(prompt: string): Promise<void> {
|
||||
async () => {
|
||||
if (await getSelectedThreadId()) return true;
|
||||
if (await textExists('No messages yet')) return true;
|
||||
return textExists('Type a message');
|
||||
return textExists('How can I help');
|
||||
},
|
||||
{ timeout: 15_000, timeoutMsg: 'Chat surface did not mount' }
|
||||
);
|
||||
|
||||
@@ -74,7 +74,7 @@ suiteRunner('Conversations web channel flow', () => {
|
||||
// 'Message OpenHuman' button was removed from Home in a redesign — navigate directly.
|
||||
await navigateToConversations();
|
||||
// If navigating to /chat doesn't show threads, retry via direct hash.
|
||||
const hasInput = await textExists('Type a message...');
|
||||
const hasInput = await textExists('How can I help you today?');
|
||||
if (!hasInput) {
|
||||
await navigateViaHash('/chat');
|
||||
await browser.pause(2_000);
|
||||
|
||||
@@ -81,7 +81,7 @@ async function navigateChatAndSend(prompt: string): Promise<void> {
|
||||
async () => {
|
||||
if (await getSelectedThreadId()) return true;
|
||||
if (await textExists('No messages yet')) return true;
|
||||
return textExists('Type a message');
|
||||
return textExists('How can I help');
|
||||
},
|
||||
{ timeout: 15_000, timeoutMsg: 'Chat surface did not mount' }
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('Multi-round tool conversation smoke', () => {
|
||||
const ok =
|
||||
(await textExists('Threads')) ||
|
||||
(await textExists('New')) ||
|
||||
(await textExists('Type a message'));
|
||||
(await textExists('How can I help'));
|
||||
expect(ok).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -96,10 +96,10 @@ describe.skip('Voice mode integration', () => {
|
||||
}
|
||||
expect(onHome).toBe(true);
|
||||
|
||||
const hasTextInput = await waitForAnyText(['Type a message', 'Threads', 'New'], 10_000);
|
||||
const hasTextInput = await waitForAnyText(['How can I help', 'Threads', 'New'], 10_000);
|
||||
expect(hasTextInput).not.toBeNull();
|
||||
|
||||
await clickButton('Start recording', 10_000);
|
||||
await clickButton('Voice mode', 10_000);
|
||||
|
||||
const voiceStatusMessage = await waitForAnyText(
|
||||
[
|
||||
@@ -116,18 +116,18 @@ describe.skip('Voice mode integration', () => {
|
||||
expect(voiceStatusMessage).not.toBeNull();
|
||||
|
||||
await clickButton('Switch to text', 10_000);
|
||||
const textRestored = await waitForAnyText(['Type a message', 'Threads', 'New'], 10_000);
|
||||
const textRestored = await waitForAnyText(['How can I help', 'Threads', 'New'], 10_000);
|
||||
expect(textRestored).not.toBeNull();
|
||||
});
|
||||
|
||||
it('surfaces a mic entry button from the text composer', async () => {
|
||||
const onConversations = await waitForAnyText(['Type a message', 'Threads', 'New'], 10_000);
|
||||
const onConversations = await waitForAnyText(['How can I help', 'Threads', 'New'], 10_000);
|
||||
if (!onConversations) {
|
||||
const tree = await dumpAccessibilityTree();
|
||||
console.log('[VoiceModeE2E] Conversations not ready. Tree:\n', tree.slice(0, 4000));
|
||||
}
|
||||
expect(onConversations).not.toBeNull();
|
||||
expect(await textExists('Start recording')).toBe(true);
|
||||
expect(await textExists('Voice mode')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -109,7 +109,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
@@ -134,7 +134,7 @@ test.describe('Chat Harness - Cancel', () => {
|
||||
await expect(page.getByText(piece, { exact: false })).toHaveCount(0);
|
||||
}
|
||||
|
||||
const composer = page.getByPlaceholder('Type a message...');
|
||||
const composer = page.getByPlaceholder('How can I help you today?');
|
||||
await expect(composer).toBeEnabled();
|
||||
await composer.fill('post-cancel probe message');
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
|
||||
@@ -117,7 +117,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -113,7 +113,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -126,7 +126,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -151,7 +151,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -134,7 +134,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -124,7 +124,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -99,7 +99,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
@@ -142,7 +142,7 @@ test.describe('Chat Tool Error Recovery', () => {
|
||||
})
|
||||
.toBeNull();
|
||||
|
||||
const composer = page.getByPlaceholder('Type a message...');
|
||||
const composer = page.getByPlaceholder('How can I help you today?');
|
||||
await expect(composer).toBeEnabled();
|
||||
|
||||
await setMockBehavior('llmStreamScript', '');
|
||||
|
||||
@@ -112,7 +112,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -99,7 +99,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -124,7 +124,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -101,7 +101,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -110,7 +110,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -16,7 +16,7 @@ test.describe('Multi-round tool conversation smoke', () => {
|
||||
|
||||
const text = await page.locator('#root').innerText();
|
||||
expect(
|
||||
['Threads', 'New thread', 'Type a message', 'Chat'].some(marker => text.includes(marker))
|
||||
['Threads', 'New thread', 'How can I help', 'Chat'].some(marker => text.includes(marker))
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ async function waitForSocketConnected(page: Page): Promise<void> {
|
||||
async function sendMessage(page: Page, prompt: string): Promise<void> {
|
||||
await waitForSocketConnected(page);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByPlaceholder('Type a message...').fill(prompt);
|
||||
await page.getByPlaceholder('How can I help you today?').fill(prompt);
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await expect(page.getByTestId('send-message-button')).toBeEnabled();
|
||||
await page.getByTestId('send-message-button').click();
|
||||
|
||||
@@ -24,7 +24,7 @@ async function openChat(page: Page): Promise<void> {
|
||||
await skipButton.first().click({ force: true });
|
||||
await expect(skipButton.first()).toBeHidden();
|
||||
}
|
||||
await expect(page.getByPlaceholder('Type a message...')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('How can I help you today?')).toBeVisible();
|
||||
}
|
||||
|
||||
async function installGetUserMediaError(page: Page, name: string): Promise<void> {
|
||||
@@ -61,7 +61,7 @@ async function restoreGetUserMedia(page: Page): Promise<void> {
|
||||
|
||||
async function switchChatIntoMicComposer(page: Page): Promise<void> {
|
||||
await dismissWalkthroughIfPresent(page);
|
||||
await page.getByRole('button', { name: 'Start recording' }).click({ force: true });
|
||||
await page.getByRole('button', { name: 'Voice mode' }).click({ force: true });
|
||||
await expect(page.getByText(/Tap and speak|Waiting for agent/i)).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Switch to text' })).toBeVisible();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ test.describe('Voice mode integration', () => {
|
||||
await switchChatIntoMicComposer(page);
|
||||
|
||||
await page.getByRole('button', { name: 'Switch to text' }).click();
|
||||
await expect(page.getByPlaceholder('Type a message...')).toBeVisible();
|
||||
await expect(page.getByPlaceholder('How can I help you today?')).toBeVisible();
|
||||
await expect(page.getByTestId('send-message-button')).toBeVisible();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user