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

Code before:
  });

  test("verify audit log table displays", async () => {
    await eventsPage.navigateToAuditLog(testDagId);

    await expect(eventsPage.eventsTable).toBeVisible();

    const rowCount = await eventsPage.tableRows.count();

    expect(rowCount).toBeGreaterThan(0);
  });

  test("verify expected columns are visible", async () => {
    await eventsPage.navigateToAuditLog(testDagId);

    await expect(eventsPage.whenColumn).toBeVisible();
    await expect(eventsPage.eventColumn).toBeVisible();
    await expect(eventsPage.ownerColumn).toBeVisible();
    await expect(eventsPage.extraColumn).toBeVisible();

    const dagIdColumn = eventsPage.eventsTable.locator('th:has-text("DAG ID")');

    await expect(dagIdColumn).not.toBeVisible();
  });

  test("should display audit log entries with valid data", async () => {
    await eventsPage.navigateToAuditLog(testDagId);

    const rows = await eventsPage.getEventLogRows();

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

    const [firstRow] = rows;

    if (!firstRow) {
      throw new Error("No rows found");
    }

    const cells = firstRow.locator("td");

    const whenCell = cells.nth(0);
    const eventCell = cells.nth(1);
    const userCell = cells.nth(2);

    const whenText = await whenCell.textContent();
    const eventText = await eventCell.textContent();
    const userText = await userCell.textContent();

    expect(whenText).toBeTruthy();
    expect(whenText?.trim()).not.toBe("");


Review comment (suggestion):
rename to `verify audit log entries display valid data`

Code after:
  });

  test("verify audit log table displays", async () => {
    await eventsPage.navigateToAuditLog(testDagId);

    await expect(eventsPage.eventsTable).toBeVisible();

    const rowCount = await eventsPage.tableRows.count();

    expect(rowCount).toBeGreaterThan(0);
  });

  test("verify expected columns are visible", async () => {
    await eventsPage.navigateToAuditLog(testDagId);

    await expect(eventsPage.whenColumn).toBeVisible();
    await expect(eventsPage.eventColumn).toBeVisible();
    await expect(eventsPage.ownerColumn).toBeVisible();
    await expect(eventsPage.extraColumn).toBeVisible();

    const dagIdColumn = eventsPage.eventsTable.locator('th:has-text("DAG ID")');

    await expect(dagIdColumn).not.toBeVisible();
  });

  test("verify audit log entries display valid data", async () => {
    await eventsPage.navigateToAuditLog(testDagId);

    const rows = await eventsPage.getEventLogRows();

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

    const [firstRow] = rows;

    if (!firstRow) {
      throw new Error("No rows found");
    }

    const whenCell = await eventsPage.getCellByColumnName(firstRow, "When");
    const eventCell = await eventsPage.getCellByColumnName(firstRow, "Event");
    const userCell = await eventsPage.getCellByColumnName(firstRow, "User");

    const whenText = await whenCell.textContent();
    const eventText = await eventCell.textContent();
    const userText = await userCell.textContent();

    expect(whenText).toBeTruthy();
    expect(whenText?.trim()).not.toBe("");

    expect(eventText).toBeTruthy();
    expect(eventText?.trim()).not.toBe("");