e2e-tests/README.md
End-to-end tests for FossFLOW using Selenium WebDriver with Python and pytest.
Use the provided test runner script:
cd e2e-tests
./run-tests.sh
The script will:
Start Selenium server with Chrome:
docker run -d --name fossflow-selenium -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:latest
Start the FossFLOW dev server:
cd .. # Go to project root
npm run dev
Install Python dependencies:
cd e2e-tests
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Run the tests:
pytest -v
FOSSFLOW_TEST_URL - Base URL of the app (default: http://localhost:3000)WEBDRIVER_URL - WebDriver endpoint (default: http://localhost:4444)Example:
FOSSFLOW_TEST_URL=http://localhost:8080 pytest -v
test_homepage_loads - Verifies the homepage loads and has basic React elementstest_page_has_canvas - Checks for the canvas element used for diagram drawingtest_page_renders_without_crash - Verifies the page fully renders with all key elements visibleTests run automatically in GitHub Actions on:
master or main branchesmaster or main branchesThe CI workflow:
e2e-tests/
├── tests/
│ └── test_basic_load.py # Main test suite
├── requirements.txt # Python dependencies
├── pytest.ini # Pytest configuration
├── run-tests.sh # Test runner script
└── README.md # This file
Create a new test file in tests/ directory (must start with test_)
Import required modules:
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
Use the driver fixture:
def test_my_feature(driver):
driver.get("http://localhost:3000")
element = driver.find_element(By.ID, "my-element")
assert element.is_displayed()
Run your test:
pytest tests/test_my_feature.py -v
To see the browser during tests, modify the driver fixture in test_basic_load.py:
# Comment out headless mode
# chrome_options.add_argument("--headless")
When using the Selenium Docker image, you can watch tests in real-time:
http://localhost:7900 (password: secret)--headless from Chrome optionsRun tests with more verbose output:
pytest -vv --tb=long
# Run a single test
pytest tests/test_basic_load.py::test_homepage_loads -v
# Run tests matching a pattern
pytest -k "canvas" -v
docker ps | grep seleniumcurl http://localhost:4444/statuscurl http://localhost:3000source venv/bin/activatepip install -r requirements.txtdocker rm -f fossflow-seleniumlsof -i :4444