diff --git a/opentrons-ai-client/src/molecules/ChatDisplay/index.tsx b/opentrons-ai-client/src/molecules/ChatDisplay/index.tsx index 4eaa840dbcb..dd39d415acc 100644 --- a/opentrons-ai-client/src/molecules/ChatDisplay/index.tsx +++ b/opentrons-ai-client/src/molecules/ChatDisplay/index.tsx @@ -18,6 +18,7 @@ import { SPACING, LegacyStyledText, TYPOGRAPHY, + OVERFLOW_AUTO, } from '@opentrons/components' import type { ChatData } from '../../resources/types' @@ -63,6 +64,7 @@ export function ChatDisplay({ chat, chatId }: ChatDisplayProps): JSX.Element { data-testid={`ChatDisplay_from_${isUser ? 'user' : 'backend'}`} borderRadius={BORDERS.borderRadius12} width="100%" + overflowY={OVERFLOW_AUTO} flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing16} position={POSITION_RELATIVE} diff --git a/opentrons-ai-client/src/organisms/UpdateProtocol/__tests__/UpdateProtocol.test.tsx b/opentrons-ai-client/src/organisms/UpdateProtocol/__tests__/UpdateProtocol.test.tsx index 5790864f92f..04c3ad3b167 100644 --- a/opentrons-ai-client/src/organisms/UpdateProtocol/__tests__/UpdateProtocol.test.tsx +++ b/opentrons-ai-client/src/organisms/UpdateProtocol/__tests__/UpdateProtocol.test.tsx @@ -6,6 +6,9 @@ import type { NavigateFunction } from 'react-router-dom' import { UpdateProtocol } from '../index' import { i18n } from '../../../i18n' +// global.Blob = BlobPolyfill as any +global.Blob = require('node:buffer').Blob + const mockNavigate = vi.fn() const mockUseTrackEvent = vi.fn() const mockUseChatData = vi.fn() @@ -14,6 +17,8 @@ vi.mock('../../../resources/hooks/useTrackEvent', () => ({ useTrackEvent: () => mockUseTrackEvent, })) +File.prototype.text = vi.fn().mockResolvedValue('test file content') + vi.mock('../../../resources/chatDataAtom', () => ({ chatDataAtom: () => mockUseChatData, })) @@ -50,7 +55,7 @@ describe('Update Protocol', () => { ).toBeInTheDocument() }) - it.skip('should update the file value when the file is uploaded', async () => { + it('should update the file value when the file is uploaded', async () => { render() const blobParts: BlobPart[] = [ @@ -74,15 +79,47 @@ describe('Update Protocol', () => { }) }) - it.skip('should have the submit prompt button disabled when the progress percentage is not 1.0', () => { + it('should not proceed when you click the submit prompt when the progress percentage is not 1.0', () => { render() - expect(screen.getByText('Submit prompt')).toBeDisabled() + expect(mockNavigate).not.toHaveBeenCalled() }) - it.skip('should call navigate to the chat page when the submit prompt button is clicked', () => { + it.skip('should call navigate to the chat page when the submit prompt button is clicked when progress is 1.0', async () => { render() + + // upload file + const blobParts: BlobPart[] = [ + 'x = 1\n', + 'x = 2\n', + 'x = 3\n', + 'x = 4\n', + 'print("x is 1.")\n', + ] + const file = new File(blobParts, 'test-file.py', { type: 'text/python' }) + fireEvent.drop(screen.getByTestId('file_drop_zone'), { + dataTransfer: { + files: [file], + }, + }) + + // input description + const describeInput = screen.getByRole('textbox') + fireEvent.change(describeInput, { target: { value: 'Test description' } }) + + expect(screen.getByDisplayValue('Test description')).toBeInTheDocument() + + // select update type + const applicationDropdown = screen.getByText('Select an option') + fireEvent.click(applicationDropdown) + + const basicOtherOption = screen.getByText('Other') + fireEvent.click(basicOtherOption) + const submitPromptButton = screen.getByText('Submit prompt') - submitPromptButton.click() + await waitFor(() => { + expect(submitPromptButton).toBeEnabled() + submitPromptButton.click() + }) expect(mockNavigate).toHaveBeenCalledWith('/chat') }) })