mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-17 10:12:02 -05:00
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.
This commit is contained in:
@@ -478,21 +478,19 @@ export async function clickRunButton(page: Page): Promise<void> {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user