Skip to content

Commit d2c10c2

Browse files
committed
fix: OPENAI_API_KEY in e2e actions
1 parent 4ef30f0 commit d2c10c2

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

e2e/playwright.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default defineConfig({
3535
HOST: "127.0.0.1",
3636
BASE_URL: "http://localhost:3003",
3737
NEXT_PUBLIC_BASE_URL: "http://localhost:3003",
38+
OPENAI_API_KEY: process.env.OPENAI_API_KEY || "",
3839
},
3940
},
4041
{
@@ -49,6 +50,7 @@ export default defineConfig({
4950
PORT: "3004",
5051
HOST: "127.0.0.1",
5152
BASE_URL: "http://localhost:3004",
53+
OPENAI_API_KEY: process.env.OPENAI_API_KEY || "",
5254
},
5355
},
5456
{
@@ -63,6 +65,7 @@ export default defineConfig({
6365
PORT: "3005",
6466
HOST: "127.0.0.1",
6567
BASE_URL: "http://localhost:3005",
68+
OPENAI_API_KEY: process.env.OPENAI_API_KEY || "",
6669
},
6770
},
6871
],

e2e/tests/smoke.chat.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
import { test, expect } from "@playwright/test";
22

3+
const hasOpenAiKey =
4+
typeof process.env.OPENAI_API_KEY === "string" &&
5+
process.env.OPENAI_API_KEY.trim().length > 0;
6+
7+
if (!hasOpenAiKey) {
8+
// eslint-disable-next-line no-console -- surfaced only when tests are skipped
9+
console.warn(
10+
"Skipping AI chat smoke tests: OPENAI_API_KEY is not available in the environment.",
11+
);
12+
}
13+
14+
test.skip(
15+
!hasOpenAiKey,
16+
"OPENAI_API_KEY is required to run AI chat smoke tests.",
17+
);
18+
319
test.describe("AI Chat Plugin", () => {
420
test("should start a new conversation and send a message", async ({
521
page,

0 commit comments

Comments
 (0)