A library to facilitate automated testing of Anvil applications based on Selenium.
pip install anvil_test
You will also need the relevant webdrivers for the browsers you wish to use. See the Selenium docs for further info.
The library contains a module of functions which you can import to use within your testing suite.
Example code using pytest to login to an anvil app, run a trivial (failing) test and close down the browser session at the end:
import pytest
from anvil_test import session
browser = 'firefox'
url = 'https://<your-app>.anvilapp.net/'
email = 'user@abc.com'
password = 'password'
@pytest.fixture
def test_session():
session.init(browser, url)
session.login(email, password)
yield
session.browser.quit()
def test_login(test_session):
assert 1 == 2