File size: 851 Bytes
2a8436f
 
 
 
 
 
a25dfc1
2a8436f
 
 
 
 
 
9cf8fb1
2a8436f
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit.testing as stt

# Define a test case for adding a person
def test_add_person():
    # Simulate user input
    with stt.install_test_input():
        stt.test_runner.start("app.py")  # Path to your Streamlit script

        # Select the "Add Person" option
        stt.test_input("Select Option", "Add Person")

        # Enter name, image path, and Instagram handle
        stt.test_input("Enter Name", "John Doe")
        stt.test_input("Upload Image", "random.jpg")  # Path to your test image
        stt.test_input("Enter Instagram Handle", "johndoe123")

        # Click the "Add Person" button
        stt.test_input("Add Person")

        # Verify the success message
        stt.test_output("Success: John Doe added to the database!")

        # Clean up
        stt.test_runner.cleanup()

# Run the test case
test_add_person()