refactor: Improve page loading, timeout, and component interaction in Simple Agent test (#4825)

* fix: Improve page loading, timeout  and component interaction in Simple Agent test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
anovazzi1 2024-11-25 21:24:29 -03:00 committed by GitHub
commit 94ea537d6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,10 +6,10 @@ import uaParser from "ua-parser-js";
test(
"Simple Agent",
{ tag: ["@release", "@starter-project"] },
async ({ page }) => {
test.skip(
!process?.env?.OPENAI_API_KEY,
"OPENAI_API_KEY required to run this test",
);
@ -38,7 +38,9 @@ test(
while (modalCount === 0) {
await page.getByText("New Flow", { exact: true }).click();
await page.waitForTimeout(3000);
await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 3000,
});
modalCount = await page.getByTestId("modal-title")?.count();
}
@ -63,14 +65,12 @@ test(
while (outdatedComponents > 0) {
await page.getByTestId("icon-AlertTriangle").first().click();
await page.waitForTimeout(1000);
outdatedComponents = await page.getByTestId("icon-AlertTriangle").count();
}
let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
await page.waitForTimeout(1000);
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}
@ -83,8 +83,6 @@ test(
await page.getByTestId("dropdown_str_model_name").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForTimeout(500);
await page.getByTestId("button_run_chat output").last().click();
await page.waitForSelector("text=built successfully", {