🔧 (typescript_test.yml): add OPENAI_API_KEY to environment variables in CI
✅ (basicExamples.spec.ts): refactor API key check to run at the start of tests
This commit is contained in:
parent
c0d394fcaf
commit
f1aa857ae1
2 changed files with 22 additions and 20 deletions
2
.github/workflows/typescript_test.yml
vendored
2
.github/workflows/typescript_test.yml
vendored
|
|
@ -25,6 +25,8 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
shardIndex: [1, 2, 3, 4, 5]
|
shardIndex: [1, 2, 3, 4, 5]
|
||||||
shardTotal: [5]
|
shardTotal: [5]
|
||||||
|
env:
|
||||||
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,11 @@ import { expect, test } from "@playwright/test";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
test("Basic Prompting (Hello, World)", async ({ page }) => {
|
test("Basic Prompting (Hello, World)", async ({ page }) => {
|
||||||
|
if (!process?.env?.OPENAI_API_KEY) {
|
||||||
|
//You must set the OPENAI_API_KEY on .env file to run this test
|
||||||
|
expect(false).toBe(true);
|
||||||
|
}
|
||||||
|
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
|
@ -32,11 +37,6 @@ test("Basic Prompting (Hello, World)", async ({ page }) => {
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
|
|
||||||
if (!process.env.OPENAI_API_KEY) {
|
|
||||||
//You must set the OPENAI_API_KEY on .env file to run this test
|
|
||||||
expect(false).toBe(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("popover-anchor-input-openai_api_key")
|
.getByTestId("popover-anchor-input-openai_api_key")
|
||||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||||
|
|
@ -90,6 +90,11 @@ test("Basic Prompting (Hello, World)", async ({ page }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Memory Chatbot", async ({ page }) => {
|
test("Memory Chatbot", async ({ page }) => {
|
||||||
|
if (!process?.env?.OPENAI_API_KEY) {
|
||||||
|
//You must set the OPENAI_API_KEY on .env file to run this test
|
||||||
|
expect(false).toBe(true);
|
||||||
|
}
|
||||||
|
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
|
@ -117,11 +122,6 @@ test("Memory Chatbot", async ({ page }) => {
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
|
|
||||||
if (!process.env.OPENAI_API_KEY) {
|
|
||||||
//You must set the OPENAI_API_KEY on .env file to run this test
|
|
||||||
expect(false).toBe(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("popover-anchor-input-openai_api_key")
|
.getByTestId("popover-anchor-input-openai_api_key")
|
||||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||||
|
|
@ -185,6 +185,11 @@ test("Memory Chatbot", async ({ page }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Document QA", async ({ page }) => {
|
test("Document QA", async ({ page }) => {
|
||||||
|
if (!process?.env?.OPENAI_API_KEY) {
|
||||||
|
//You must set the OPENAI_API_KEY on .env file to run this test
|
||||||
|
expect(false).toBe(true);
|
||||||
|
}
|
||||||
|
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
|
@ -212,11 +217,6 @@ test("Document QA", async ({ page }) => {
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
|
|
||||||
if (!process.env.OPENAI_API_KEY) {
|
|
||||||
//You must set the OPENAI_API_KEY on .env file to run this test
|
|
||||||
expect(false).toBe(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("popover-anchor-input-openai_api_key")
|
.getByTestId("popover-anchor-input-openai_api_key")
|
||||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||||
|
|
@ -279,6 +279,11 @@ test("Document QA", async ({ page }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Blog Writer", async ({ page }) => {
|
test("Blog Writer", async ({ page }) => {
|
||||||
|
if (!process?.env?.OPENAI_API_KEY) {
|
||||||
|
//You must set the OPENAI_API_KEY on .env file to run this test
|
||||||
|
expect(false).toBe(true);
|
||||||
|
}
|
||||||
|
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
|
@ -306,11 +311,6 @@ test("Blog Writer", async ({ page }) => {
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
await page.getByTitle("zoom out").click();
|
await page.getByTitle("zoom out").click();
|
||||||
|
|
||||||
if (!process.env.OPENAI_API_KEY) {
|
|
||||||
//You must set the OPENAI_API_KEY on .env file to run this test
|
|
||||||
expect(false).toBe(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
await page
|
await page
|
||||||
.getByTestId("popover-anchor-input-openai_api_key")
|
.getByTestId("popover-anchor-input-openai_api_key")
|
||||||
.fill(process.env.OPENAI_API_KEY ?? "");
|
.fill(process.env.OPENAI_API_KEY ?? "");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue