test: add pokedex agent and social media agent integration tests (#7087)
✨ (Pokedex Agent.spec.ts): Add integration test for Pokedex Agent to interact with the Pokédex feature and verify expected outputs ✨ (Social Media Agent.spec.ts): Add integration test for Social Media Agent to interact with social media platforms and verify expected outputs
This commit is contained in:
parent
4d3e1458da
commit
72f2528216
2 changed files with 121 additions and 0 deletions
52
src/frontend/tests/core/integrations/Pokedex Agent.spec.ts
Normal file
52
src/frontend/tests/core/integrations/Pokedex Agent.spec.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import * as dotenv from "dotenv";
|
||||
import path from "path";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { initialGPTsetup } from "../../utils/initialGPTsetup";
|
||||
import { withEventDeliveryModes } from "../../utils/withEventDeliveryModes";
|
||||
|
||||
withEventDeliveryModes(
|
||||
"Pokedex Agent",
|
||||
{ tag: ["@release", "@starter-projects"] },
|
||||
async ({ page }) => {
|
||||
test.skip(
|
||||
!process?.env?.OPENAI_API_KEY,
|
||||
"OPENAI_API_KEY required to run this test",
|
||||
);
|
||||
|
||||
if (!process.env.CI) {
|
||||
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
|
||||
}
|
||||
|
||||
await awaitBootstrapTest(page);
|
||||
|
||||
await page.getByTestId("side_nav_options_all-templates").click();
|
||||
await page.getByRole("heading", { name: "Pokédex Agent" }).click();
|
||||
|
||||
await initialGPTsetup(page);
|
||||
|
||||
await page.getByTestId("playground-btn-flow-io").click();
|
||||
|
||||
await page
|
||||
.getByTestId("input-chat-playground")
|
||||
.last()
|
||||
.fill("Can I catch a Charizard in Pokemon Yellow?");
|
||||
|
||||
await page.getByTestId("button-send").last().click();
|
||||
|
||||
const stopButton = page.getByRole("button", { name: "Stop" });
|
||||
await stopButton.waitFor({ state: "visible", timeout: 30000 });
|
||||
|
||||
if (await stopButton.isVisible()) {
|
||||
await expect(stopButton).toBeHidden({ timeout: 120000 });
|
||||
}
|
||||
|
||||
const output = await page
|
||||
.getByTestId("div-chat-message")
|
||||
.last()
|
||||
.innerText();
|
||||
expect(output).toContain("Charmander");
|
||||
expect(output).toContain("Route 24");
|
||||
expect(output.length).toBeGreaterThan(100);
|
||||
},
|
||||
);
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import * as dotenv from "dotenv";
|
||||
import path from "path";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
import { initialGPTsetup } from "../../utils/initialGPTsetup";
|
||||
import { withEventDeliveryModes } from "../../utils/withEventDeliveryModes";
|
||||
|
||||
withEventDeliveryModes(
|
||||
"Social Media Agent",
|
||||
{ tag: ["@release", "@starter-projects"] },
|
||||
async ({ page }) => {
|
||||
test.skip(
|
||||
!process?.env?.APIFY_API_TOKEN,
|
||||
"APIFY_API_TOKEN required to run this test",
|
||||
);
|
||||
|
||||
if (!process.env.CI) {
|
||||
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
|
||||
}
|
||||
|
||||
await awaitBootstrapTest(page);
|
||||
|
||||
await page.getByTestId("side_nav_options_all-templates").click();
|
||||
await page.getByRole("heading", { name: "Social Media Agent" }).click();
|
||||
|
||||
await initialGPTsetup(page);
|
||||
|
||||
const apifyApiTokenInputCount = await page
|
||||
.getByTestId("popover-anchor-input-apify_token")
|
||||
.count();
|
||||
|
||||
for (let i = 0; i < apifyApiTokenInputCount; i++) {
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-apify_token")
|
||||
.nth(i)
|
||||
.fill(process.env.APIFY_API_TOKEN ?? "");
|
||||
}
|
||||
|
||||
await page
|
||||
.getByTestId("popover-anchor-input-apify_token")
|
||||
.nth(apifyApiTokenInputCount - 1)
|
||||
.fill(process.env.APIFY_API_TOKEN ?? "");
|
||||
|
||||
await page.getByTestId("playground-btn-flow-io").click();
|
||||
|
||||
await page
|
||||
.getByTestId("input-chat-playground")
|
||||
.last()
|
||||
.fill(
|
||||
"Find the TikTok profile of the company OpenAI using Google search, then show me the profile bio and their latest video.",
|
||||
);
|
||||
|
||||
await page.getByTestId("button-send").last().click();
|
||||
|
||||
const stopButton = page.getByRole("button", { name: "Stop" });
|
||||
await stopButton.waitFor({ state: "visible", timeout: 30000 });
|
||||
|
||||
if (await stopButton.isVisible()) {
|
||||
await expect(stopButton).toBeHidden({ timeout: 120000 });
|
||||
}
|
||||
|
||||
const output = await page
|
||||
.getByTestId("div-chat-message")
|
||||
.last()
|
||||
.innerText();
|
||||
expect(output).toContain("TikTok");
|
||||
expect(output.length).toBeGreaterThan(300);
|
||||
},
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue