diff --git a/tests/e2e/management/test_key_models_dropdown_e2e.py b/tests/e2e/management/test_key_models_dropdown_e2e.py index 676e3ccffcf..bebf63fe18f 100644 --- a/tests/e2e/management/test_key_models_dropdown_e2e.py +++ b/tests/e2e/management/test_key_models_dropdown_e2e.py @@ -70,7 +70,18 @@ def _submit_create_modal(page: Page, sentinel_label: str) -> str: def _open_key_edit_form(page: Page, key_alias: str) -> None: page.goto(f"{UI_BASE_URL}/ui/api-keys/") - page.get_by_text(key_alias).first.click() + # The list is async; wait for the provisioned row before opening detail. + row = page.locator("tr").filter(has_text=key_alias).first + expect(row).to_be_visible(timeout=60_000) + # Key Alias is plain text. KeyInfoView opens from the Key ID control in the + # same row (blue truncated hash button on the tremor table / IdCell on the + # newer DataTable). Prefer that button; fall back to the alias text for + # layouts where the Key column itself is the click target. + key_id_button = row.locator("button").first + if key_id_button.count() > 0: + key_id_button.click() + else: + row.get_by_text(key_alias, exact=True).click() page.get_by_role("tab", name="Settings").click() page.get_by_role("button", name="Edit Settings").click() expect(_form_item(page, "Models")).to_be_visible() @@ -155,7 +166,10 @@ class TestKeyModelsDropdownUI: _open_key_edit_form(ui_page, key_alias) - options = _models_dropdown_texts(ui_page, must_contain="All Team Models") - assert "gpt-5.5" in options, f"team key edit lost the team's own model: {options}" + # Wait on a real team model: All Team Models is rendered immediately while + # availableModels is still fetching, so requiring only the sentinel races + # the async team-model load and can read an incomplete dropdown. + options = _models_dropdown_texts(ui_page, must_contain="gpt-5.5") + assert "All Team Models" in options, f"team key edit lost 'All Team Models': {options}" assert "All Proxy Models" not in options, f"team key edit offered 'All Proxy Models': {options}" assert "all-proxy-models" not in options, f"team key edit offered the raw sentinel: {options}"