guidewire-oss / fern-reporter

A ginkgo test reporter extension for storing test run information and also for reporting html pages
Apache License 2.0
20 stars 11 forks source link

Feat: Support for Cursor Based Pagination #125

Closed fvarg00 closed 3 days ago

fvarg00 commented 1 month ago

This PR supports cursor-based pagination for the testRuns graphql endpoint and returns a small portion of the data at a time and avoiding performance issues related to loading all data at once.

E.g.

  1. First Query Execution:
query GetTestRuns {
  testRuns(first: 3, after: "" ) {
    edges {
      cursor
      testRun {
        id
        testProjectName
        ...
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

Result: The query fetches the first 3 testRuns. Let's say the endCursor returned is "cursor_3", and hasNextPage is true.

  1. Subsequent Query Execution: To fetch the next set of testRuns, you use the endCursor from the previous result as the after value:
query GetTestRuns {
  testRuns(first: 3, after: "cursor_3") {
    edges {
      cursor
      testRun {
        id
        testProjectName
        ...
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

Result: This will return the next 3 testRuns after "cursor_3". If more items are available, the endCursor value and hasNextPage will be updated accordingly.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Files with missing lines Coverage Δ
pkg/graph/resolvers/schema.resolvers.go 100.00% <100.00%> (ø)
pkg/utils/utils.go 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

anoop2811 commented 5 days ago

@fvarg00 : How is this going? If this is completed, please try to get this reviewed in the fern community meeting and also rebase from master

fvarg00 commented 5 days ago

@dependabot rebase

fvarg00 commented 4 days ago

@anoop2811 This one is done and complete. I've requested a review and will bring it up at the next fern community meeting as well. Rebased from mainbranch.