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

Code before:

    await providers.waitForLoad();
    // Assert Providers page loaded
    await expect(providers.heading).toBeVisible();
    expect(await providers.getRowCount()).toBeGreaterThan(0);
  });

  test("Verify the providers list displays", async () => {
    await expect(providers.table).toBeVisible();
  });

  test("Verify package name, version, and description are not blank", async () => {
    const count = await providers.getRowCount();

    expect(count).toBeGreaterThan(0);

    for (let i = 0; i < 2; i++) {
      const { description, packageName, version } = await providers.getRowDetails(i);

      expect(packageName).not.toEqual("");
      expect(version).not.toEqual("");
      expect(description).not.toEqual("");
    }
  });

  test("verify pagination controls navigate between pages", async () => {
    await providers.navigateTo("/providers?limit=5&offset=0");
    await providers.waitForLoad();

    const page1Initial = await providers.providerNames();

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

    const pagination = providers.page.locator('[data-scope="pagination"]');

    await pagination.getByRole("button", { name: /^page 2$/i }).click();
    await expect.poll(() => providers.providerNames(), { timeout: 30_000 }).not.toEqual(page1Initial);

    const page2Assets = await providers.providerNames();

    await pagination.getByRole("button", { name: /page 1/i }).click();

    await expect.poll(() => providers.providerNames(), { timeout: 30_000 }).not.toEqual(page2Assets);
  });
});


Review comment (suggestion):
@sarth-akvaish lets see how pagination tests are done dor dagpage and others. Let's ensure we use same approach

Code after:

    await providers.waitForLoad();
    // Assert Providers page loaded
    await expect(providers.heading).toBeVisible();
    expect(await providers.getRowCount()).toBeGreaterThan(0);
  });

  test("Verify the providers list displays", async () => {
    await expect(providers.table).toBeVisible();
  });

  test("Verify package name, version, and description are not blank", async () => {
    const count = await providers.getRowCount();

    expect(count).toBeGreaterThan(0);

    for (let i = 0; i < 2; i++) {
      const { description, packageName, version } = await providers.getRowDetails(i);

      expect(packageName).not.toEqual("");
      expect(version).not.toEqual("");
      expect(description).not.toEqual("");
    }
  });

  test("verify providers pagination", async () => {
    const limit = 5;

    await providers.navigateTo(`/providers?offset=0&limit=${limit}`);
    await providers.waitForLoad();

    const rows = await providers.getRowCount();

    expect(rows).toBeGreaterThan(0);

    const initialProviderNames = await providers.providerNames();

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

    await expect(providers.paginationNextButton).toBeVisible();
    await expect(providers.paginationPrevButton).toBeVisible();

    await providers.paginationNextButton.click();
    await providers.waitForLoad();

    await providers.page.waitForURL((url) => {
      const u = new URL(url);
      const offset = u.searchParams.get("offset");

      return offset !== null && offset !== "0";
    });