chore(tests): add e2e tests for messaging suite (#387)

* feat(NewConversationMenu): add id to the new conversation menu button
refactor(EndpointItem): remove onSelect prop and setTokenDialogOpen state variable
test(messages.spec.js): add e2e test for messaging suite to check if textbox is focused after receiving message

* test(Input): add test id to input field for e2e testing
test(messages.spec.js): add endpoint variable and refactor test to check if textbox is focused after receiving message

* test(messages.spec.js): refactor test to use a variable for message content

Refactored the test to use a variable for message content instead of a hardcoded string.
This commit is contained in:
Danny Avila 2023-05-26 17:34:08 -04:00 committed by GitHub
parent c0845ad0b1
commit fd5afc09a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 1 deletions

View file

@ -15,7 +15,7 @@ const alternateName = {
google: 'PaLM'
};
export default function ModelItem({ endpoint, value, onSelect }) {
export default function ModelItem({ endpoint, value }) {
const [setTokenDialogOpen, setSetTokenDialogOpen] = useState(false);
const endpointsConfig = useRecoilValue(store.endpointsConfig);
@ -33,6 +33,7 @@ export default function ModelItem({ endpoint, value, onSelect }) {
<>
<DropdownMenuRadioItem
value={value}
id={endpoint}
className="group dark:font-semibold dark:text-gray-100 dark:hover:bg-gray-800"
>
{icon}

View file

@ -126,6 +126,7 @@ export default function NewConversationMenu() {
<DropdownMenu open={menuOpen} onOpenChange={setMenuOpen}>
<DropdownMenuTrigger asChild>
<Button
id="new-conversation-menu"
variant="outline"
className={`group relative mb-[-12px] ml-0 mt-[-8px] items-center rounded-md border-0 p-1 outline-none focus:ring-0 focus:ring-offset-0 dark:data-[state=open]:bg-opacity-50 md:left-1 md:ml-[-12px] md:pl-1`}
>

View file

@ -142,6 +142,8 @@ export default function TextChat({ isSearchView = false }) {
>
<NewConversationMenu />
<TextareaAutosize
// set test id for e2e testing
data-testid="text-input"
tabIndex="0"
autoFocus
ref={inputRef}