Skip to content

Commit

Permalink
Merge pull request #37 from chromaui/ghengeveld/ap-3492-projecttests-…
Browse files Browse the repository at this point in the history
…api-returns-only-100-results

Query `testsForStory` and `testsForStatus` separately to avoid pagination
  • Loading branch information
ghengeveld authored Aug 22, 2023
2 parents 5514185 + 4a8d155 commit c33ab36
Show file tree
Hide file tree
Showing 14 changed files with 333 additions and 137 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"@storybook/channels": "^7.3.0",
"@storybook/client-logger": "^7.3.0",
"@storybook/eslint-config-storybook": "^3.1.2",
"@storybook/jest": "^0.2.1",
"@storybook/manager-api": "^7.3.0",
"@storybook/react": "^7.3.0",
"@storybook/react-vite": "^7.3.0",
Expand Down
17 changes: 11 additions & 6 deletions src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
const documents = {
"\n query SelectProjectsQuery {\n viewer {\n accounts {\n id\n name\n avatarUrl\n projects {\n id\n name\n webUrl\n projectToken\n lastBuild {\n branch\n number\n }\n }\n }\n }\n }\n": types.SelectProjectsQueryDocument,
"\n query ProjectQuery($projectId: ID!) {\n project(id: $projectId) {\n id\n name\n webUrl\n lastBuild {\n branch\n number\n }\n }\n }\n": types.ProjectQueryDocument,
"\n query AddonVisualTestsBuild(\n $hasBuildId: Boolean!\n $buildId: ID!\n $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n ) {\n build(id: $buildId) @include(if: $hasBuildId) {\n ...BuildFields\n }\n project(id: $projectId) @skip(if: $hasBuildId) {\n name\n lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...BuildFields\n }\n }\n }\n": types.AddonVisualTestsBuildDocument,
"\n fragment BuildFields on Build {\n __typename\n id\n number\n branch\n commit\n uncommittedHash\n status\n browsers {\n id\n key\n name\n }\n ... on StartedBuild {\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n tests {\n nodes {\n ...TestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n tests {\n nodes {\n ...TestFields\n }\n }\n }\n }\n": types.BuildFieldsFragmentDoc,
"\n fragment TestFields on Test {\n id\n status\n result\n webUrl\n comparisons {\n id\n result\n browser {\n id\n key\n name\n version\n }\n captureDiff {\n diffImage {\n imageUrl\n }\n }\n headCapture {\n captureImage {\n imageUrl\n }\n }\n viewport {\n id\n name\n width\n isDefault\n }\n }\n parameters {\n viewport {\n id\n name\n width\n isDefault\n }\n }\n story {\n storyId\n }\n }\n": types.TestFieldsFragmentDoc,
"\n query AddonVisualTestsBuild(\n $hasBuildId: Boolean!\n $buildId: ID!\n $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n $storyId: String!\n $testStatuses: [TestStatus!]!\n ) {\n build(id: $buildId) @include(if: $hasBuildId) {\n ...BuildFields\n }\n project(id: $projectId) @skip(if: $hasBuildId) {\n name\n lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...BuildFields\n }\n }\n }\n": types.AddonVisualTestsBuildDocument,
"\n fragment BuildFields on Build {\n __typename\n id\n number\n branch\n commit\n uncommittedHash\n status\n browsers {\n id\n key\n name\n }\n ... on StartedBuild {\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n }\n": types.BuildFieldsFragmentDoc,
"\n fragment StatusTestFields on Test {\n id\n status\n story {\n storyId\n }\n }\n": types.StatusTestFieldsFragmentDoc,
"\n fragment StoryTestFields on Test {\n id\n status\n result\n webUrl\n comparisons {\n id\n result\n browser {\n id\n key\n name\n version\n }\n captureDiff {\n diffImage {\n imageUrl\n }\n }\n headCapture {\n captureImage {\n imageUrl\n }\n }\n viewport {\n id\n name\n width\n isDefault\n }\n }\n parameters {\n viewport {\n id\n name\n width\n isDefault\n }\n }\n story {\n storyId\n }\n }\n": types.StoryTestFieldsFragmentDoc,
"\n mutation ReviewTest($input: ReviewTestInput!) {\n reviewTest(input: $input) {\n updatedTests {\n id\n status\n }\n userErrors {\n ... on UserError {\n __typename\n message\n }\n ... on BuildSupersededError {\n build {\n id\n }\n }\n ... on TestUnreviewableError {\n test {\n id\n }\n }\n }\n }\n }\n": types.ReviewTestDocument,
};

Expand Down Expand Up @@ -46,15 +47,19 @@ export function graphql(source: "\n query ProjectQuery($projectId: ID!) {\n
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query AddonVisualTestsBuild(\n $hasBuildId: Boolean!\n $buildId: ID!\n $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n ) {\n build(id: $buildId) @include(if: $hasBuildId) {\n ...BuildFields\n }\n project(id: $projectId) @skip(if: $hasBuildId) {\n name\n lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...BuildFields\n }\n }\n }\n"): (typeof documents)["\n query AddonVisualTestsBuild(\n $hasBuildId: Boolean!\n $buildId: ID!\n $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n ) {\n build(id: $buildId) @include(if: $hasBuildId) {\n ...BuildFields\n }\n project(id: $projectId) @skip(if: $hasBuildId) {\n name\n lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...BuildFields\n }\n }\n }\n"];
export function graphql(source: "\n query AddonVisualTestsBuild(\n $hasBuildId: Boolean!\n $buildId: ID!\n $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n $storyId: String!\n $testStatuses: [TestStatus!]!\n ) {\n build(id: $buildId) @include(if: $hasBuildId) {\n ...BuildFields\n }\n project(id: $projectId) @skip(if: $hasBuildId) {\n name\n lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...BuildFields\n }\n }\n }\n"): (typeof documents)["\n query AddonVisualTestsBuild(\n $hasBuildId: Boolean!\n $buildId: ID!\n $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n $storyId: String!\n $testStatuses: [TestStatus!]!\n ) {\n build(id: $buildId) @include(if: $hasBuildId) {\n ...BuildFields\n }\n project(id: $projectId) @skip(if: $hasBuildId) {\n name\n lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...BuildFields\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment BuildFields on Build {\n __typename\n id\n number\n branch\n commit\n uncommittedHash\n status\n browsers {\n id\n key\n name\n }\n ... on StartedBuild {\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n tests {\n nodes {\n ...TestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n tests {\n nodes {\n ...TestFields\n }\n }\n }\n }\n"): (typeof documents)["\n fragment BuildFields on Build {\n __typename\n id\n number\n branch\n commit\n uncommittedHash\n status\n browsers {\n id\n key\n name\n }\n ... on StartedBuild {\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n tests {\n nodes {\n ...TestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n tests {\n nodes {\n ...TestFields\n }\n }\n }\n }\n"];
export function graphql(source: "\n fragment BuildFields on Build {\n __typename\n id\n number\n branch\n commit\n uncommittedHash\n status\n browsers {\n id\n key\n name\n }\n ... on StartedBuild {\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n }\n"): (typeof documents)["\n fragment BuildFields on Build {\n __typename\n id\n number\n branch\n commit\n uncommittedHash\n status\n browsers {\n id\n key\n name\n }\n ... on StartedBuild {\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n changeCount: testCount(results: [ADDED, CHANGED, FIXED])\n brokenCount: testCount(results: [CAPTURE_ERROR])\n startedAt\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment TestFields on Test {\n id\n status\n result\n webUrl\n comparisons {\n id\n result\n browser {\n id\n key\n name\n version\n }\n captureDiff {\n diffImage {\n imageUrl\n }\n }\n headCapture {\n captureImage {\n imageUrl\n }\n }\n viewport {\n id\n name\n width\n isDefault\n }\n }\n parameters {\n viewport {\n id\n name\n width\n isDefault\n }\n }\n story {\n storyId\n }\n }\n"): (typeof documents)["\n fragment TestFields on Test {\n id\n status\n result\n webUrl\n comparisons {\n id\n result\n browser {\n id\n key\n name\n version\n }\n captureDiff {\n diffImage {\n imageUrl\n }\n }\n headCapture {\n captureImage {\n imageUrl\n }\n }\n viewport {\n id\n name\n width\n isDefault\n }\n }\n parameters {\n viewport {\n id\n name\n width\n isDefault\n }\n }\n story {\n storyId\n }\n }\n"];
export function graphql(source: "\n fragment StatusTestFields on Test {\n id\n status\n story {\n storyId\n }\n }\n"): (typeof documents)["\n fragment StatusTestFields on Test {\n id\n status\n story {\n storyId\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment StoryTestFields on Test {\n id\n status\n result\n webUrl\n comparisons {\n id\n result\n browser {\n id\n key\n name\n version\n }\n captureDiff {\n diffImage {\n imageUrl\n }\n }\n headCapture {\n captureImage {\n imageUrl\n }\n }\n viewport {\n id\n name\n width\n isDefault\n }\n }\n parameters {\n viewport {\n id\n name\n width\n isDefault\n }\n }\n story {\n storyId\n }\n }\n"): (typeof documents)["\n fragment StoryTestFields on Test {\n id\n status\n result\n webUrl\n comparisons {\n id\n result\n browser {\n id\n key\n name\n version\n }\n captureDiff {\n diffImage {\n imageUrl\n }\n }\n headCapture {\n captureImage {\n imageUrl\n }\n }\n viewport {\n id\n name\n width\n isDefault\n }\n }\n parameters {\n viewport {\n id\n name\n width\n isDefault\n }\n }\n story {\n storyId\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading

0 comments on commit c33ab36

Please sign in to comment.