test: Update API key requirements and test configurations for frontend tests (#5752)
This commit is contained in:
parent
a5f5f3e3e3
commit
36b3289da2
2 changed files with 16 additions and 17 deletions
|
|
@ -1,14 +1,8 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import * as dotenv from "dotenv";
|
||||
import path from "path";
|
||||
import { addNewApiKeys } from "../../utils/add-new-api-keys";
|
||||
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { getAllResponseMessage } from "../../utils/get-all-response-message";
|
||||
import { initialGPTsetup } from "../../utils/initialGPTsetup";
|
||||
import { removeOldApiKeys } from "../../utils/remove-old-api-keys";
|
||||
import { selectGptModel } from "../../utils/select-gpt-model";
|
||||
import { updateOldComponents } from "../../utils/update-old-components";
|
||||
import { waitForOpenModalWithChatInput } from "../../utils/wait-for-open-modal";
|
||||
|
||||
test(
|
||||
|
|
@ -17,7 +11,7 @@ test(
|
|||
async ({ page }) => {
|
||||
test.skip(
|
||||
!process?.env?.ANTHROPIC_API_KEY,
|
||||
"OPENAI_API_KEY required to run this test",
|
||||
"ANTHROPIC_API_KEY required to run this test",
|
||||
);
|
||||
|
||||
if (!process.env.CI) {
|
||||
|
|
@ -35,16 +29,18 @@ test(
|
|||
timeout: 100000,
|
||||
});
|
||||
|
||||
await initialGPTsetup(page);
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-api_key")
|
||||
.last()
|
||||
.fill(process.env.ANTHROPIC_API_KEY ?? "");
|
||||
|
||||
const apiKeyInput = page.getByTestId(
|
||||
"popover-anchor-input-anthropic_api_key",
|
||||
);
|
||||
const isApiKeyInputVisible = await apiKeyInput.isVisible();
|
||||
await page.waitForSelector('[data-testid="dropdown_str_model_name"]', {
|
||||
timeout: 5000,
|
||||
});
|
||||
|
||||
if (isApiKeyInputVisible) {
|
||||
await apiKeyInput.fill(process.env.ANTHROPIC_API_KEY ?? "");
|
||||
}
|
||||
await page.getByTestId("dropdown_str_model_name").click();
|
||||
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page.getByTestId("button_run_chat output").click();
|
||||
await page.waitForSelector("text=built successfully", { timeout: 30000 });
|
||||
|
|
@ -63,7 +59,9 @@ test(
|
|||
|
||||
const textContents = await getAllResponseMessage(page);
|
||||
expect(textContents.length).toBeGreaterThan(100);
|
||||
expect(await page.getByTestId("chat-code-tab").isVisible()).toBe(true);
|
||||
expect(await page.getByTestId("chat-code-tab").last().isVisible()).toBe(
|
||||
true,
|
||||
);
|
||||
expect(textContents).toContain("langflow");
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ test(
|
|||
cleanCode = cleanCode.replace("FloatInput(", "SliderInput(");
|
||||
cleanCode = cleanCode.replace(
|
||||
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput",
|
||||
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput, SliderInput",
|
||||
"from langflow.io import BoolInput, DictInput, DropdownInput, FloatInput, IntInput, StrInput, SliderInput\n" +
|
||||
"from langflow.field_typing.range_spec import RangeSpec",
|
||||
);
|
||||
|
||||
cleanCode = cleanCode.replace(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue