From eaaca882a83e65a165c729de76cd6024890dcfd4 Mon Sep 17 00:00:00 2001 From: abhi1992002 Date: Tue, 17 Feb 2026 11:33:15 +0530 Subject: [PATCH] fix(tests): Simplify button click logic in library.page.ts Refactored the button click handling in the `clickRunButton` function to streamline the process of checking visibility and clicking the "Start Task" button. Removed unnecessary variable assignments and combined waiting and clicking actions into a single line for improved readability and efficiency. --- .../frontend/src/tests/pages/library.page.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/autogpt_platform/frontend/src/tests/pages/library.page.ts b/autogpt_platform/frontend/src/tests/pages/library.page.ts index 137a5aadd3..e561149c75 100644 --- a/autogpt_platform/frontend/src/tests/pages/library.page.ts +++ b/autogpt_platform/frontend/src/tests/pages/library.page.ts @@ -478,21 +478,19 @@ export async function clickRunButton(page: Page): Promise { // Now check which button is visible and click it if (await setupTaskButton.isVisible()) { await setupTaskButton.click(); - const startTaskButton = page + await page .getByRole("button", { name: /Start Task/i }) - .first(); - await startTaskButton.waitFor({ state: "visible", timeout: 10000 }); - await startTaskButton.click(); + .first() + .click({ timeout: 10000 }); return; } if (await newTaskButton.isVisible()) { await newTaskButton.click(); - const startTaskButton = page + await page .getByRole("button", { name: /Start Task/i }) - .first(); - await startTaskButton.waitFor({ state: "visible", timeout: 10000 }); - await startTaskButton.click(); + .first() + .click({ timeout: 10000 }); return; }