The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(ui-e2e): read the virtual key from its own pre in the Save your Key dialog (#47408)
yuneng-jiang1ef59fab8b76
diff --git a/tests/e2e/ui/tests/internal-user/internalUser.spec.ts b/tests/e2e/ui/tests/internal-user/internalUser.spec.tsindex d34bc034453..cb7d9320744 100644--- a/tests/e2e/ui/tests/internal-user/internalUser.spec.ts+++ b/tests/e2e/ui/tests/internal-user/internalUser.spec.ts@@ -67,7 +67,7 @@ test.describe("Internal User", () => {await page.getByRole("button", { name: "Create Key", exact: true }).click();await expect(page.getByText("Save your Key")).toBeVisible({ timeout: 10_000 });- const apiKey = (await page.getByRole("dialog", { name: "Save your Key" }).locator("pre").innerText()).trim();+ const apiKey = (await page.getByRole("dialog", { name: "Save your Key" }).locator("pre").filter({ hasText: /^sk-/ }).innerText()).trim();expect(apiKey).toMatch(/^sk-/);await page.keyboard.press("Escape");diff --git a/tests/e2e/ui/tests/proxy-admin/keys.spec.ts b/tests/e2e/ui/tests/proxy-admin/keys.spec.tsindex deb7ae70d07..d3d67bde1cf 100644--- a/tests/e2e/ui/tests/proxy-admin/keys.spec.ts+++ b/tests/e2e/ui/tests/proxy-admin/keys.spec.ts@@ -254,7 +254,7 @@ test.describe("Proxy Admin - Keys", () => {// verify it can call /chat/completions for the model it was scoped to.// The mock LLM server (fixtures/mock_llm_server/server.py) replies with// a fixed "This is a mock response." body.- const apiKey = (await page.getByRole("dialog", { name: "Save your Key" }).locator("pre").innerText()).trim();+ const apiKey = (await page.getByRole("dialog", { name: "Save your Key" }).locator("pre").filter({ hasText: /^sk-/ }).innerText()).trim();expect(apiKey).toMatch(/^sk-/);const response = await page.request.post("/chat/completions", {diff --git a/tests/e2e/ui/tests/proxy-admin/secondAdmin.spec.ts b/tests/e2e/ui/tests/proxy-admin/secondAdmin.spec.tsindex 4572f71b3db..835a26af0dc 100644--- a/tests/e2e/ui/tests/proxy-admin/secondAdmin.spec.ts+++ b/tests/e2e/ui/tests/proxy-admin/secondAdmin.spec.ts@@ -69,7 +69,7 @@ test.describe("Second proxy admin", () => {await page.getByRole("button", { name: "Create Key", exact: true }).click();await expect(page.getByText("Save your Key")).toBeVisible({ timeout: 10_000 });- const apiKey = (await page.getByRole("dialog", { name: "Save your Key" }).locator("pre").innerText()).trim();+ const apiKey = (await page.getByRole("dialog", { name: "Save your Key" }).locator("pre").filter({ hasText: /^sk-/ }).innerText()).trim();expect(apiKey).toMatch(/^sk-/);await page.keyboard.press("Escape");diff --git a/tests/e2e/ui/tests/team-admin/memberPermissions.spec.ts b/tests/e2e/ui/tests/team-admin/memberPermissions.spec.tsindex b7978fae7fb..95000b0ff18 100644--- a/tests/e2e/ui/tests/team-admin/memberPermissions.spec.ts+++ b/tests/e2e/ui/tests/team-admin/memberPermissions.spec.ts@@ -130,7 +130,7 @@ test.describe("Team Admin - Member permissions", () => {await memberPage.getByRole("button", { name: "Create Key", exact: true }).click();const saveDialog = memberPage.getByRole("dialog", { name: "Save your Key" });await expect(saveDialog).toBeVisible({ timeout: 15_000 });- const apiKey = (await saveDialog.locator("pre").innerText()).trim();+ const apiKey = (await saveDialog.locator("pre").filter({ hasText: /^sk-/ }).innerText()).trim();expect(apiKey).toMatch(/^sk-/);createdKeys.push(apiKey);await memberPage.keyboard.press("Escape");