Repository: apache/airflow
File: airflow-core/src/airflow/ui/tests/e2e/specs/dag-tasks.spec.ts (TypeScript)

Code before:
    await expect(dagPage.taskCards).toContainText("runme_0");
  });

  test("should filter tasks by operator", async ({ page }) => {
    const dagPage = new DagsPage(page);

    await dagPage.navigateToDagTasks(DAG_ID);

    await dagPage.filterByOperator("BashOperator");

    await expect(dagPage.taskCards.first()).toBeVisible();
    await expect(dagPage.taskCards.first()).toContainText("BashOperator");
  });

  test("should filter tasks by trigger rule", async ({ page }) => {
    const dagPage = new DagsPage(page);

    await dagPage.navigateToDagTasks(DAG_ID);

    await dagPage.filterByTriggerRule("all_success");

    await expect(dagPage.taskCards.first()).toBeVisible();
    await expect(dagPage.taskCards.first()).toContainText("all_success");
  });

  test("should filter tasks by retries", async ({ page }) => {
    const dagPage = new DagsPage(page);

    await dagPage.navigateToDagTasks(DAG_ID);

    await dagPage.retriesFilter.click();
    const option = page.locator('div[role="option"]').first();

    if (await option.isVisible()) {
      await option.click();
      await page.keyboard.press("Escape");
      await expect(dagPage.taskCards.first()).toBeVisible();
    } else {
      await dagPage.retriesFilter.click();
    }
  });

  test("should filter tasks by mapped status", async ({ page }) => {
    const dagPage = new DagsPage(page);

    await dagPage.navigateToDagTasks(DAG_ID);

    await dagPage.filterByMappedStatus("Not mapped");

    await expect(dagPage.taskCards.first()).toBeVisible();
  });

Review comment (suggestion):
```suggestion
 test("verify filter by retries", async ({ page }) => {
  const dagPage = new DagsPage(page);
  await dagPage.navigateToDagTasks(testDagId);
  
  await dagPage.retriesFilter.click();
  const option = page.locator('div[role="option"]').first();
  
  // Skip if no retry options available for this DAG
  const hasOptions = await option.isVisible();
  if (!hasOptions) {
    test.skip(true, "No retry options available for test DAG");
    return;
  }
  
  await option.click();
  await expect(dagPage.taskCards.first()).toBeVisible();
});
```

Code after:

    await expect(page).toHaveURL(/\/tasks$/);
    await expect(dagPage.taskCards.first()).toBeVisible();

    const firstCard = dagPage.taskCards.first();

    await expect(firstCard.locator("a").first()).toBeVisible();
    await expect(firstCard).toContainText("Operator");
    await expect(firstCard).toContainText("Trigger Rule");
    await expect(firstCard).toContainText("Last Instance");
  });

  test("verify search tasks by name", async ({ page }) => {
    const dagPage = new DagsPage(page);

    await dagPage.navigateToDagTasks(testDagId);

    const firstTaskLink = dagPage.taskCards.first().locator("a").first();
    const taskName = await firstTaskLink.textContent();

    if (taskName === null) {
      throw new Error("Task name not found");
    }

    await dagPage.searchBox.fill(taskName);

    await expect.poll(() => dagPage.taskCards.count(), { timeout: 20_000 }).toBe(1);
    await expect(dagPage.taskCards).toContainText(taskName);
  });

  test("verify filter tasks by operator dropdown", async ({ page }) => {
    const dagPage = new DagsPage(page);

    await dagPage.navigateToDagTasks(testDagId);

    const operators = await dagPage.getFilterOptions(dagPage.operatorFilter);

    expect(operators.length).toBeGreaterThan(0);

    for (const operator of operators) {
      await dagPage.filterByOperator(operator);

      await expect
        .poll(
          async () => {
            const count = await dagPage.taskCards.count();

            if (count === 0) return false;
            for (let i = 0; i < count; i++) {
              const text = await dagPage.taskCards.nth(i).textContent();