Skip to content

Replace Selenium with Playwright for functional tests #3762

@Simrayz

Description

@Simrayz

Our functional test suite currently uses Selenium with gunicorn, Chrome, Firefox, geckodriver and chromedriver. This is somewhat troublesome to maintain:

  • Dependencies are pinned to outdated versions (Selenium and urrlib) due to breaking changes that are left unresolved. This also affects integration tests.
  • Test infrastructure is somewhat fragile. Gunicorn polls the subprocess until it responds, and tests use a lot of sleep() commands to wait for the frontend to update its state.
  • The Docker image installs a lot of dependencies in order to run the headless browser for testing, and requires drivers to interact with the browsers.

Playwright offers a better alternative:

  • Auto-waiting allows Playwright to wait for elements to be actionable, and is handled by the library instead of manual sleep calls.
  • The test server can be simplified by using the built-in LiveServerThread in Django
  • The docker image is lighter because we can use the browser binary from Playwright, without extra browser repositories or drivers.
  • Fewer dependencies are needed to run functional tests, and we can remove selenium, gunicorn and whitenoise.

The test suite is small (7 tests across 6 files), so this change is low risk and should make the tests more reliable.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions