mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
fix(e2e): open key edit via Key ID and wait for team models
Key Alias text is not the row open control on the virtual keys table; KeyInfoView opens from the Key ID button in that row. Also wait for a real team model in the edit Models dropdown so we do not race the async availableModels fetch that only has All Team Models on first paint
This commit is contained in:
parent
08804123eb
commit
32427a610f
1 changed files with 17 additions and 3 deletions
|
|
@ -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}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue