From 0b9235c6464bc0bd87bc19faea8d5388bf4f92c1 Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Fri, 26 Jun 2026 19:28:27 -0400 Subject: [PATCH] test(#5021): keep active-profile recovery harness aligned --- tests/test_5001_active_profile_recovery.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_5001_active_profile_recovery.py b/tests/test_5001_active_profile_recovery.py index 82ab2f2a..d2b14635 100644 --- a/tests/test_5001_active_profile_recovery.py +++ b/tests/test_5001_active_profile_recovery.py @@ -11,6 +11,7 @@ import pytest ROOT = Path(__file__).resolve().parent.parent BOOT_JS = ROOT / "static" / "boot.js" NODE = shutil.which("node") +BOOT_MARKER_KEY = "hermes-webui-active-profile-bootstrap-401" pytestmark = pytest.mark.skipif( @@ -144,6 +145,15 @@ function makeApiAttempt(attempt) { }; } +const budgetBlock = extractBlock( + bootSrc, + ' const _bootActiveProfileUnauthRedirectBudget=(()=>{', + ' // Fetch active profile' +); +eval(budgetBlock.replace( + ' const _bootActiveProfileUnauthRedirectBudget=(()=>{', + ' globalThis._bootActiveProfileUnauthRedirectBudget=(()=>{' +)); eval(extractFunction(bootSrc, '_resolveActiveProfileBootstrapState')); const bootActiveProfileBlock = extractBlock( bootSrc, @@ -297,8 +307,8 @@ def test_active_profile_boot_recovery_is_one_shot_and_bounded(driver_path): assert payload["attempts"][1]["applyBotNameCalls"] == 1 assert payload["loadCalls"] == 2 assert payload["redirects"] == ["login?next=%2F"] - assert payload["storageHistory"][0].get("test-5001-active-profile-recovery") == "1" - assert payload["storageHistory"][1].get("test-5001-active-profile-recovery") is None + assert payload["storageHistory"][0].get(BOOT_MARKER_KEY) == "1" + assert payload["storageHistory"][1].get(BOOT_MARKER_KEY) is None assert payload["storageSnapshot"] == {} @@ -327,8 +337,8 @@ def test_active_profile_boot_recovery_handles_loader_thrown_401s(driver_path): assert payload["attempts"][1]["bootIsDefault"] is True assert payload["attempts"][1]["applyBotNameCalls"] == 1 assert payload["redirects"] == ["login?next=%2F"] - assert payload["storageHistory"][0].get("test-5001-active-profile-recovery-throws") == "1" - assert payload["storageHistory"][1].get("test-5001-active-profile-recovery-throws") is None + assert payload["storageHistory"][0].get(BOOT_MARKER_KEY) == "1" + assert payload["storageHistory"][1].get(BOOT_MARKER_KEY) is None assert payload["storageSnapshot"] == {}