- Added `applySearchReplace` function to handle search and replace operations with fuzzy matching capabilities. - Introduced tests for various scenarios including fuzzy matching with typos, exact matches, and handling whitespace differences. - Created a parser for search/replace blocks to facilitate the new functionality. - Updated prompts for search-replace operations to clarify usage and examples. - Added utility functions for text normalization and language detection based on file extensions. - Implemented a minimal stdio MCP server for local testing with tools for adding numbers and printing environment variables.
62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import { expect } from "@playwright/test";
|
|
import { test as testWithPo } from "./helpers/test_helper";
|
|
|
|
testWithPo("Azure provider settings UI", async ({ po }) => {
|
|
await po.setUp();
|
|
await po.goToSettingsTab();
|
|
|
|
// Look for Azure OpenAI in the provider list
|
|
await expect(po.page.getByText("Azure OpenAI")).toBeVisible();
|
|
|
|
// Navigate to Azure provider settings
|
|
await po.page.getByText("Azure OpenAI").click();
|
|
|
|
// Wait for Azure settings page to load
|
|
await po.page.waitForSelector('h1:has-text("Configure Azure OpenAI")', {
|
|
state: "visible",
|
|
timeout: 5000,
|
|
});
|
|
|
|
// Confirm the new configuration form is rendered
|
|
await expect(
|
|
po.page.getByText("Azure OpenAI Configuration Required"),
|
|
).toBeVisible();
|
|
await expect(po.page.getByLabel("Resource Name")).toBeVisible();
|
|
await expect(po.page.getByLabel("API Key")).toBeVisible();
|
|
await expect(
|
|
po.page.getByRole("button", { name: "Save Settings" }),
|
|
).toBeVisible();
|
|
|
|
// Environment variable helper section should still be available
|
|
await expect(
|
|
po.page.getByText("Environment Variables (optional)"),
|
|
).toBeVisible();
|
|
|
|
// FIX: disambiguate text matches to avoid strict mode violation
|
|
await expect(
|
|
po.page.getByText("AZURE_API_KEY", { exact: true }),
|
|
).toBeVisible();
|
|
await expect(
|
|
po.page.getByText("AZURE_RESOURCE_NAME", { exact: true }),
|
|
).toBeVisible();
|
|
|
|
// Since no env vars are configured in the test run, both should read "Not Set"
|
|
await expect(
|
|
po.page
|
|
.getByTestId("azure-api-key-status")
|
|
.getByText("Not Set", { exact: true }),
|
|
).toBeVisible();
|
|
await expect(
|
|
po.page
|
|
.getByTestId("azure-resource-name-status")
|
|
.getByText("Not Set", { exact: true }),
|
|
).toBeVisible();
|
|
|
|
// The guidance text should explain precedence between saved settings and environment variables
|
|
await expect(
|
|
po.page.getByText(
|
|
"Values saved in Settings take precedence over environment variables.",
|
|
),
|
|
).toBeVisible();
|
|
});
|