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:
abhi1992002
2026-02-17 11:33:15 +05:30
parent ef52537197
commit eaaca882a8

View File

@@ -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;
}