Skip to content

Webdriver debugging tips

Carolyn Au edited this page Aug 29, 2025 · 2 revisions

Run a single test once

Search for tests by keyword expression e.g., to run the test "get_chart_map_regions" in the vis_map_test.py file:

./run_test.sh -w -k get_chart_map_regions

Debug a test

To fix a test, you might want to iterate on both the test and server code. One suggestion to speed up that process is:

1. Run the servers in a separate terminal

First setup the environment:

export FLASK_ENV=webdriver
export GOOGLE_CLOUD_PROJECT=datcom-website-dev
ENABLE_MODEL=true

then either run ./run_servers.sh --verbose or ./run_cdc_dev.sh --verbose

2. Iterate on the test in another terminal

In another window, run the specific test. Use the -k flag to select a test method by keyword, or specify the test file in the path (or both).

python3 -m pytest server/webdriver/cdc_tests/vis_map_test.py -k test_manually_enter_option

Keep iterating by re-running the test, or updating server code (which will get reloaded on save).

Other tips

Some other things you can do in the test to help with debugging:

Take a screenshot:

Add the following line to the test to save a screenshot in the repo root folder:

self.driver.save_screenshot("your_screenshot_filename.png")

Clone this wiki locally