Streamsync: Better Streamlit alternative? Answer it by automation test!
Get started with Streamsynch and playwrite for automation testing
Streamsync is a zero-frontend-code UI library for python so it is an alternative to Gradio and Streamlit. This library is open source like gradio but get the freedom of Streamlit to create interfaces.
I just see explanation about streamsyc here so I show how it can be easily tested with playwrite.
This article is made after my study it in this repo.
Pro & Con
The Streamsynch have a freedom and html/css/js more like interface that is better than Gradio and Streamlit for freedom and customization.
That is also an advanteges because you can customize more but you must know more.
Another advantages is the edit tool with UI in witch you can put elements into the UI and automatically generate the JSON file that describe the UI. It also suggest how to use funcion from pyton.
Make simple app
Use this commands to create testapp
pip install streamsync
streamsync create testapp
Now you can run the app with:
streamsync run testapp
(And you can edit with `streamsync edit testapp`)
pip install pytest-playwright
Create first test file test/test_testapp.py
from playwright.sync_api import Page, expect
def test_streamsyc_app(page: Page):
button_plus = page.get_by_role("button", name="Increment")
button_less = page.get_by_role("button", name="Decrement")
With running server we can run test with
Test automation pipeline
For made the test automation pipeline on gitlab you can use the following .gitlab-ci.yml
- apt update
- apt install -y python3 python3-pip
- pip install -r requirements.txt
- pip install pytest-playwright
- playwright install
- playwright install-deps
- streamsync run testapp &
- pytest test
Streamsync is a bit hard than streamlit and gradio but it is more ready for production and get help by frontend developers to made together and simply a good UI and UX experience.
It is all open source! So contribute!