feat: add text sentiment analysis template (#6945)

* feat: add text sentiment analysis template

* update templates

* [autofix.ci] apply automated fixes

* update tags and icon

Co-Authored-By: Tarcio  <rodriguestarcio.adv@gmail.com>

* Update Text Sentiment Analysis.json

Co-Authored-By: Tarcio  <rodriguestarcio.adv@gmail.com>

* note-cleanup

*  (Text Sentiment Analysis.spec.ts): add integration test for text sentiment analysis feature in the frontend to ensure user can analyze text sentiment accurately.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Tarcio <rodriguestarcio.adv@gmail.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
This commit is contained in:
Victor-w-Madeira 2025-03-20 16:34:11 -03:00 committed by GitHub
commit 6a9a4e94ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3064 additions and 0 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,59 @@
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(
"user should be able to analyze text sentiment",
{ 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: "Text Sentiment Analysis" })
.click();
await initialGPTsetup(page);
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByTestId("button_upload_file").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(
path.join(__dirname, "../../assets/test_file.txt"),
);
await page.getByText("test_file.txt").isVisible();
await page.waitForSelector('[data-testid="button_run_chat output"]', {
timeout: 3000,
});
await page.getByTestId("button_run_chat output").last().click();
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.getByText("Playground", { exact: true }).last().click();
await page
.getByText("Add a Chat Input component to your flow to send messages.", {
exact: true,
})
.last()
.isVisible();
const textAnalysis = await page.locator(".markdown").last().textContent();
expect(textAnalysis?.length).toBeGreaterThan(100);
},
);