From 43fdd1c79d165822d5fc42141549c81b92532665 Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Wed, 7 Oct 2026 00:29:29 +0200 Subject: [PATCH] fix(tests): Expect React login page in integration tests Sentry now enables React authentication by default (getsentry/sentry#126486). The login page is served at /auth/login/ instead of redirecting to /auth/login/sentry/, and it has no form to read the CSRF token from, so take the token from the CSRF cookie instead. Co-Authored-By: Claude --- _integration-test/test_01_basics.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/_integration-test/test_01_basics.py b/_integration-test/test_01_basics.py index 72d103dced8..7218f857d54 100644 --- a/_integration-test/test_01_basics.py +++ b/_integration-test/test_01_basics.py @@ -72,9 +72,8 @@ def get_organization_token(client: httpx.Client, csrf_token: str, name: str) -> @pytest.fixture(scope="session") def authenticated_session(): client = httpx.Client() - response = client.get(SENTRY_TEST_HOST, follow_redirects=True) - parser = BeautifulSoup(response.text, "html.parser") - login_csrf_token = parser.find("input", {"name": "csrfmiddlewaretoken"})["value"] + client.get(SENTRY_TEST_HOST, follow_redirects=True) + login_csrf_token = client.cookies["sc"] login_response = client.post( f"{SENTRY_TEST_HOST}/auth/login/sentry/", follow_redirects=True, @@ -107,7 +106,7 @@ def client_login(authenticated_session): def test_initial_redirect(): initial_auth_redirect = httpx.get(SENTRY_TEST_HOST, follow_redirects=True) - assert initial_auth_redirect.url == f"{SENTRY_TEST_HOST}/auth/login/sentry/" + assert initial_auth_redirect.url == f"{SENTRY_TEST_HOST}/auth/login/" def test_asset_internal_rewrite():