Unverified 提交 9bc5e138 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Fix Azure e2e test so it doesn't leak (#1248)

<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Scoped Azure e2e test env setup to prevent leaking variables across tests. Added testWithConfigSkipIfWindows and moved Azure env vars into a per-test preLaunchHook; the Azure test now skips on Windows. <!-- End of auto-generated description by cubic. -->
上级 72acb31d
import { testSkipIfWindows } from "./helpers/test_helper";
import { testWithConfigSkipIfWindows } from "./helpers/test_helper";
// Set environment variables before the test runs to enable Azure testing
process.env.TEST_AZURE_BASE_URL = "http://localhost:3500/azure";
process.env.AZURE_API_KEY = "fake-azure-key-for-testing";
process.env.AZURE_RESOURCE_NAME = "fake-resource-for-testing";
testSkipIfWindows("send message through Azure OpenAI", async ({ po }) => {
const testAzure = testWithConfigSkipIfWindows({
preLaunchHook: async () => {
process.env.TEST_AZURE_BASE_URL = "http://localhost:3500/azure";
process.env.AZURE_API_KEY = "fake-azure-key-for-testing";
process.env.AZURE_RESOURCE_NAME = "fake-resource-for-testing";
},
});
testAzure("send message through Azure OpenAI", async ({ po }) => {
// Set up Azure without test provider
await po.setUpAzure();
......
......@@ -1152,6 +1152,17 @@ export function testWithConfig(config: ElectronConfig) {
});
}
export function testWithConfigSkipIfWindows(config: ElectronConfig) {
if (os.platform() === "win32") {
return test.skip;
}
return test.extend({
electronConfig: async ({}, use) => {
await use(config);
},
});
}
// Wrapper that skips tests on Windows platform
export const testSkipIfWindows = os.platform() === "win32" ? test.skip : test;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论