Integration tests
Backend
Pytest and Flask provide easy integration testing by providing test clients to make API calls on a built application. Python makes it easy to mock any data we might need to test via the unittest module.
Frontend
Vitest allows us to test components in a way that ensures their functionality when interacting with the backend. With Axios we can make real API requests to the backend using front end components and validate that the frontend correctly processes and displays the received data.
Integration Test for Use Case 1
Users wants to ask the chatbot questions related to bioinformatics.
-
The user clicks on the weblink and is brought to our website's front page.
-
A question is inputted into the chatbox.
-
The chatbot processes the question to understand how to answer.
-
The chatbot determines the answer by the following criteria:
-
If the answer is found from the documentation:
- A tutorial will pop up with the method of choice for the user to use for his or her Bioinformatics Research.
-
If the answer is not found in the documentation:
- The chatbot will say "I don't know" as an answer for the user.
-
Details
-
Runs
Frontend / Renders chat input and messages containerunit test. -
Runs
Frontend / Allows user to type in chat inputunit test. -
Runs
Frontend/ Submits a message and adds responseunit test. -
Runs
Frontend/ Displays error when submitting empty inputunit test. -
Runs
Frontend / Error message resets after 5 secondsunit test. -
Runs
Frontend / Renders input field and submit buttonunit test. -
Runs
Frontend/ Renders with the correct input valueunit test. -
Runs
Frontend/ Updates input value when user typesunit test. -
Runs
Frontend / Calls handleSubmit when form is submittedunit test. -
Runs
Backend/ Test_chat_message_validunit test. -
Runs
Backend/ Test_chat_message_missingunit test. -
Runs
Backend/ Test_query_vector_db_with_docunit test. -
Runs
Backend/ Test_query_vector_db_no_docunit test. -
Runs
Backend/ Test_testingunit test. -
Runs
Backend/ Test_handle_chat_with__message_and_history_docunit test. -
Runs
Backend/ Test_handle_chat_with_no_messageunit test. -
Runs
Backend/ Test_handle_chat_with_no_conversationunit test. -
Runs
Backend/ Test_handle_chat_with__message_and_history_no_docunit test. -
Passes if all tests pass.
Integration Test for Use Case 2
User wants to download conversation.
-
A conversation between the user and chatbot has finished.
-
The user selects the "Download Conversation" button and decides which format (.pdf, .txt, .doc, etc) to save the file as.
-
A notification appears on the screen that the download is ready to be saved to the user's computer.
-
The user presses the "Save" button to save the history of the converstation with the chatbot file to their device.
Details
- Runs
Frontend / Displays error when downloading empty conversation for txtunit test. - Runs
Frontend / Displays error when downloading empty conversation for pdfunit test. - Runs
Frontend/ Displays error when downloading empty conversation for docunit test. - Runs
Frontend/ Downloads chatbot conversation when there is at least one message for .txtunit test. - Runs
Frontend / Downloads chatbot conversation when there is at least one message for .pdfunit test. - Runs
Frontend/ Downloads chatbot conversation when there is at least one message for .docunit test. - Passes if all tests pass.
Integration Test for Use Case 3
Users wants to view previous messages sent.
- The chatbot and the user are currently in conversation with one another.
- The user navigates to the scroll bar.
- He or she moves the bar up or down so that the past conversations are shown on the screen.
Details
- Runs
Frontend/ Stores messages in sessionStorageunit test. - Runs
Frontend / Renders previous messages from sessionStorageunit test. - Runs
Frontend/ Calls scrollIntoView when messages state updatesunit test. - Runs
Frontend/ Renders with text (User Bubble)unit test. - Runs
Frontend/ Renders with text (Response Bubble)unit test. - Passes if all tests pass.
Integration Test for Use Case 4
A user wants to to edit and resend a message.
- The chatbot gave an answer that the user was unsatisfied with.
- The user highlights over the question asked.
- He or she selects the edit icon.
- The user has the option to update the message before resending.
- The user clicks send and the chatbot reanwers the question.
Details
-
Runs
Frontend/ Calls onEdit function when edit button is clickedunit test. -
Passes if all tests pass.
Integration Test for Use Case 5
The user wants to create a new chat.
- The user clicks on the + button in the type right-hand corner.
- He or she notices the chat is cleared.
Details
- Runs
Frontend / Renders previous messages from sessionStorageunit test. - Runs
Frontend / Clears state and stops loading when New Chat is clickedunit test. - Passes if all tests pass.
Integration Test for Use Case 6
An admin wants to upload a document for the chatbot to use.
- The user signs into the backend and then gets redirect to admin dashboard.
- The user then selects the upload option and gets redirected to the upload page.
- The user selects ONLY pdf files to be loaded to the database.
Details
- Runs
Backend/ Test_upload_pdf_validunit test. - Runs
Backend/ Test_upload_pdf_dupunit test. - Runs
Backend/ Test_validationunit test. - Runs
Backend/ Test_content_fileunit test. - Runs
Backend/ Test_parse_pdfunit test. - Runs
Backend/ Test_index_docunit test. - Runs
Backend/ Test_duplicate_chunks_ignoredunit test. - Runs
Backend/ Test_empty_fileunit test. - Passes if all tests pass.
Integration Test for Use Case 7
An admin wants to delete a document from the database.
- The user signs into the backend and then gets redirect to admin dashboard.
- User will see red color delete option in PDF UI table.
- User clicks on delete and PDF will be instantly deleted from Database.
Details
- Runs
Backend/ Test_delete_valid_documentunit test. - Runs
Backend/ Test_delete_non_existent_documentunit test. - Runs
Backend/ Test_delete_database_errorunit test. - Passes if all tests pass.
Integration Test for Use Case 8
A user wants to download a document from the database.
- The user sees the red download button on the front page of the backend (no need to sign in).
- The user clicks the download button to retrieve the document.
Details
- Runs
Backend/ Test_download_valid_documentunit test. - Runs
Backend/ Test_download_non_existent_documentunit test. - Runs
Backend/ Test_download_database_errorunit test. - Passes if all tests pass.
Integration Test for Use Case 9
An admin should be able to log in and perform admin-only actions.
- The user signs into the backend and then gets redirect to admin dashboard.
Details
- Runs
Backend/ Login_userunit test. - Runs
Backend/ Test_user_tableunit test. - Runs
Backend/ Test_user_table_with_userunit test. - Runs
Backend/ Test_user_table_passwordunit test. - Runs
Backend/ Test_testingunit test. - Passes if all tests pass.