diff --git a/e2e-tests/azure_send_message.spec.ts b/e2e-tests/azure_send_message.spec.ts index 9f23aba..ead36d6 100644 --- a/e2e-tests/azure_send_message.spec.ts +++ b/e2e-tests/azure_send_message.spec.ts @@ -1,11 +1,16 @@ -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(); diff --git a/e2e-tests/helpers/test_helper.ts b/e2e-tests/helpers/test_helper.ts index 194aab5..4bea2bb 100644 --- a/e2e-tests/helpers/test_helper.ts +++ b/e2e-tests/helpers/test_helper.ts @@ -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;