Skip to content

Frontend regression testing#2566

Open
fekoch wants to merge 22 commits intoe-valuation:mainfrom
fekoch:frontend-regression-testing
Open

Frontend regression testing#2566
fekoch wants to merge 22 commits intoe-valuation:mainfrom
fekoch:frontend-regression-testing

Conversation

@fekoch
Copy link
Collaborator

@fekoch fekoch commented Nov 24, 2025

This PR adds a subclass of LiveServerTest: VisualRegressionTestCase. This allows to write test cases like StaffSemesterViewRegressionTest, which are standard live server tests where you can use self.trigger_screenshot(<identifier>).
The screenshot is then compared to a known good screenshot and the testcase fails, if there is a large enough difference (as specified by us) between the two.

The CI needs to provide three environment variables for the test to establish a connection to testing api:

  • VRT_APIURL
  • VRT_APIKEY
  • VRT_PROJECT

@fekoch fekoch force-pushed the frontend-regression-testing branch from 9c2dc91 to 1dd288a Compare November 24, 2025 20:21

import django.test
import django_webtest
import requests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to declare this dependency

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, roughly how painful would it be to do this without requests? If it's just 10-ish more lines of python with urllib, I'm tempted to use that instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, we have requests in our uv.lock either way through mozilla-django-oidc; I don't have a strong opinion towards either direction

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah if we already install it anyway, fine with me

(although mozilla-django-oidc is a candidate for removal as soon as possible :D)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The python standard library documentation explicitly recommends using the Requests package: https://docs.python.org/3/library/http.client.html

Considering that, I think it is fair to explicitly depend on it.

@fekoch fekoch force-pushed the frontend-regression-testing branch from 82622b2 to 4a7243f Compare December 1, 2025 21:27
@fekoch fekoch force-pushed the frontend-regression-testing branch 2 times, most recently from 699a166 to 8ecae58 Compare December 15, 2025 21:14
@fekoch fekoch force-pushed the frontend-regression-testing branch 4 times, most recently from 3136822 to ff3180a Compare January 12, 2026 19:29
@fekoch fekoch force-pushed the frontend-regression-testing branch from 61642c4 to f4b4496 Compare February 23, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants