From e59d5e8b2791c1d8546f48423e8a3d605ec8d38a Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 7 Sep 2023 21:18:54 +1000 Subject: [PATCH 1/8] Show outdated message when new test is available --- src/screens/VisualTests/BuildResults.tsx | 30 +++-- .../SnapshotComparison.stories.tsx | 10 +- .../VisualTests/SnapshotComparison.tsx | 114 ++++++++++-------- src/screens/VisualTests/StoryInfo.stories.ts | 31 +++-- src/screens/VisualTests/StoryInfo.tsx | 31 ++--- .../VisualTests/VisualTests.stories.tsx | 7 +- src/screens/VisualTests/VisualTests.tsx | 3 +- 7 files changed, 133 insertions(+), 93 deletions(-) diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index 0f2fc4f4..bd01ab18 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -17,9 +17,10 @@ import { ReviewTestBatch, StoryBuildFieldsFragment, TestResult, + TestStatus, } from "../../gql/graphql"; import { BuildProgress } from "./BuildProgress"; -import { FragmentStoryTestFields } from "./graphql"; +import { FragmentStatusTestFields, FragmentStoryTestFields } from "./graphql"; import { RenderSettings } from "./RenderSettings"; import { SnapshotComparison } from "./SnapshotComparison"; import { StoryInfo } from "./StoryInfo"; @@ -34,7 +35,6 @@ interface BuildResultsProps { isAccepting: boolean; onAccept: (testId: string, batch: ReviewTestBatch) => Promise; setAccessToken: (accessToken: string | null) => void; - uncommittedHash: string; } export const BuildResults = ({ @@ -46,7 +46,6 @@ export const BuildResults = ({ onAccept, storyBuild, setAccessToken, - uncommittedHash, }: BuildResultsProps) => { const [settingsVisible, setSettingsVisible] = useState(false); const [warningsVisible, setWarningsVisible] = useState(false); @@ -54,11 +53,12 @@ export const BuildResults = ({ const toggleBaselineImage = () => setBaselineImageVisible(!baselineImageVisible); const isRunningBuildInProgress = runningBuild && runningBuild.step !== "complete"; + const isNextBuildSelected = nextBuild.id === storyBuild?.id; const showBuildStatus = // We always want to show the status of the running build (until it is done) isRunningBuildInProgress || // Even if there's no build running, we want to show the next build if it hasn't been selected. - nextBuild.id !== storyBuild?.id; + !isNextBuildSelected; const runningBuildIsNextBuild = runningBuild && runningBuild?.id === nextBuild?.id; const buildStatus = showBuildStatus && ( + nextTests.find((t) => t.story.storyId === storyId).status !== TestStatus.InProgress + ); // It shouldn't be possible for one test to be skipped but not all of them const isSkipped = !!storyTests?.find((t) => t.result === TestResult.Skipped); @@ -112,7 +122,6 @@ export const BuildResults = ({ BuildStatus.Prepared, ].includes(storyBuild?.status); const startedAt = "startedAt" in storyBuild && storyBuild.startedAt; - const isOutdated = storyBuild && storyBuild.uncommittedHash !== uncommittedHash; const isBuildFailed = storyBuild.status === BuildStatus.Failed; return ( @@ -123,16 +132,23 @@ export const BuildResults = ({ {!isStoryBuildStarting && storyTests && storyTests.length > 0 && ( )} diff --git a/src/screens/VisualTests/SnapshotComparison.stories.tsx b/src/screens/VisualTests/SnapshotComparison.stories.tsx index e864bf1d..0f21e178 100644 --- a/src/screens/VisualTests/SnapshotComparison.stories.tsx +++ b/src/screens/VisualTests/SnapshotComparison.stories.tsx @@ -24,6 +24,7 @@ const meta = { { status: TestStatus.Passed, viewport: 1200 }, ], }), + isNextBuildSelected: true, isAccepting: false, onAccept: action("onAccept"), baselineImageVisible: false, @@ -76,8 +77,8 @@ export const WithSingleTest: Story = { export const WithSingleTestAccepting: Story = { args: { + ...WithSingleTest.args, isAccepting: true, - tests: [makeTest({ status: TestStatus.Pending })], }, }; @@ -87,6 +88,13 @@ export const WithSingleTestAccepted: Story = { }, }; +export const WithSingleTestOutdated: Story = { + args: { + ...WithSingleTest.args, + isNextBuildSelected: false, + }, +}; + export const WithSingleTestShowingBaseline: Story = { args: { tests: [makeTest({ status: TestStatus.Pending })], diff --git a/src/screens/VisualTests/SnapshotComparison.tsx b/src/screens/VisualTests/SnapshotComparison.tsx index 0cd750ba..4ac6d883 100644 --- a/src/screens/VisualTests/SnapshotComparison.tsx +++ b/src/screens/VisualTests/SnapshotComparison.tsx @@ -41,19 +41,21 @@ const StackTrace = styled.div(({ theme }) => ({ interface SnapshotSectionProps { tests: StoryTestFieldsFragment[]; + isNextBuildSelected: boolean; isAccepting: boolean; - baselineImageVisible: boolean; onAccept: (testId: StoryTestFieldsFragment["id"], batch?: ReviewTestBatch) => void; + baselineImageVisible: boolean; } export const SnapshotComparison = ({ tests, + isNextBuildSelected, isAccepting, onAccept, baselineImageVisible, }: SnapshotSectionProps) => { const [diffVisible, setDiffVisible] = useState(true); - const [focusVisible, setFocusVisible] = useState(false); + const [focusVisible] = useState(false); const { selectedTest, selectedComparison, onSelectBrowser, onSelectMode } = useTests(tests); const { status, isInProgress, changeCount, browserResults, modeResults } = summarizeTests(tests); @@ -63,6 +65,7 @@ export const SnapshotComparison = ({ "error" in selectedComparison?.headCapture?.captureError && selectedComparison?.headCapture?.captureError?.error; + const isAcceptable = changeCount > 0 && selectedTest.status !== TestStatus.Accepted; return ( <> {isInProgress ? ( @@ -111,62 +114,73 @@ export const SnapshotComparison = ({ )} - {changeCount > 0 && selectedTest.status !== TestStatus.Accepted && ( - <> + {isAcceptable && + (!isNextBuildSelected ? ( } + tooltip={} trigger="hover" hasChrome={false} > - onAccept(selectedTest.id)}> - Accept - + - - onAccept(selectedTest.id, ReviewTestBatch.Spec), - disabled: isAccepting, - loading: isAccepting, - }, - { - id: "acceptComponent", - title: "Accept component", - center: "Accept all unreviewed changes for this component", - onClick: () => onAccept(selectedTest.id, ReviewTestBatch.Component), - disabled: isAccepting, - loading: isAccepting, - }, - { - id: "acceptBuild", - title: "Accept entire build", - center: "Accept all unreviewed changes for every story in the Storybook", - onClick: () => onAccept(selectedTest.id, ReviewTestBatch.Build), - disabled: isAccepting, - loading: isAccepting, - }, - ]} - > - {(active) => ( - - {isAccepting ? ( - - ) : ( - - )} + ) : ( + <> + + } + trigger="hover" + hasChrome={false} + > + onAccept(selectedTest.id)}> + Accept - )} - - - - )} + + + + onAccept(selectedTest.id, ReviewTestBatch.Spec), + disabled: isAccepting, + loading: isAccepting, + }, + { + id: "acceptComponent", + title: "Accept component", + center: "Accept all unreviewed changes for this component", + onClick: () => onAccept(selectedTest.id, ReviewTestBatch.Component), + disabled: isAccepting, + loading: isAccepting, + }, + { + id: "acceptBuild", + title: "Accept entire build", + center: "Accept all unreviewed changes for every story in the Storybook", + onClick: () => onAccept(selectedTest.id, ReviewTestBatch.Build), + disabled: isAccepting, + loading: isAccepting, + }, + ]} + > + {(active) => ( + + {isAccepting ? ( + + ) : ( + + )} + + )} + + + + ))} )} diff --git a/src/screens/VisualTests/StoryInfo.stories.ts b/src/screens/VisualTests/StoryInfo.stories.ts index 16e0ddc7..9cf56bf2 100644 --- a/src/screens/VisualTests/StoryInfo.stories.ts +++ b/src/screens/VisualTests/StoryInfo.stories.ts @@ -11,7 +11,7 @@ const meta = { isStarting: false, startedAt: new Date(Date.now() - 1000 * 60 * 2), // 2 minutes ago startDevBuild: action("startDevBuild"), - isOutdated: false, + isStoryOutdated: false, isBuildFailed: false, }, } satisfies Meta; @@ -31,7 +31,11 @@ export const Announced: Story = { // The build hasn't start properly yet but is already out of date export const AnnouncedOutdated: Story = { ...Announced, - args: { ...Announced.args, isOutdated: true }, + args: { + ...Announced.args, + isStoryOutdated: true, + switchToNextBuild: action("switchToNextBuild"), + }, }; // The build failed before the test had stories @@ -49,7 +53,8 @@ export const InProgress: Story = { export const InProgressOutdated: Story = { args: { tests: [makeTest({ status: TestStatus.InProgress })], - isOutdated: true, + isStoryOutdated: true, + switchToNextBuild: action("switchToNextBuild"), }, }; @@ -63,16 +68,8 @@ export const PendingOutdated: Story = { ...Pending, args: { ...Pending.args, - isOutdated: true, - }, -}; - -// Immediately after clicking "Run tests" in the story above -export const PendingOutdatedStarting: Story = { - ...PendingOutdated, - args: { - ...PendingOutdated.args, - isStarting: true, + isStoryOutdated: true, + switchToNextBuild: action("switchToNextBuild"), }, }; @@ -94,6 +91,14 @@ export const Broken: Story = { }, }; +// Immediately after clicking run tests in the story above +export const BrokenStarting: Story = { + args: { + tests: [makeTest({ status: TestStatus.Broken })], + isStarting: true, + }, +}; + // The story itself failed export const Failed: Story = { args: { diff --git a/src/screens/VisualTests/StoryInfo.tsx b/src/screens/VisualTests/StoryInfo.tsx index a0b72ae9..b5561293 100644 --- a/src/screens/VisualTests/StoryInfo.tsx +++ b/src/screens/VisualTests/StoryInfo.tsx @@ -1,4 +1,4 @@ -import { Icons, TooltipNote, WithTooltip } from "@storybook/components"; +import { Icons, Link } from "@storybook/components"; import { formatDistance } from "date-fns"; import pluralize from "pluralize"; import React from "react"; @@ -20,10 +20,12 @@ interface StoryInfoSectionProps { startedAt?: Date; /** Start a new build */ startDevBuild: () => void; - /** Could the build be outdated (as per git) */ - isOutdated: boolean; /** Did the build fail entirely? */ isBuildFailed: boolean; + /** is the story we are looking at already replaced by a completed capture on the next build? */ + isStoryOutdated: boolean; + /** Select the next build if it isn't this build */ + switchToNextBuild?: () => void; } export const StoryInfo = ({ @@ -31,8 +33,9 @@ export const StoryInfo = ({ tests, startedAt, startDevBuild, - isOutdated, isBuildFailed, + isStoryOutdated, + switchToNextBuild, }: StoryInfoSectionProps) => { // isInProgress means we have tests but they are still unfinished const { status, isInProgress, changeCount, brokenCount, modeResults, browserResults } = @@ -47,7 +50,7 @@ export const StoryInfo = ({ // isErrored means there's a problem with the story const isErrored = isFailed || status === TestStatus.Broken; - const showButton = (isOutdated || isErrored) && !isRunning; + const showButton = isErrored && !isRunning; const buttonInProgress = isRunning && !isFailed; let details; @@ -73,19 +76,17 @@ export const StoryInfo = ({ ); - } else if (isOutdated) { + } else if (isStoryOutdated) { details = ( - Snapshots outdated - } - trigger="hover" - hasChrome={false} - > - - + + {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} + + View latest snapshot + +
- Run tests to see what changed + Newer test results are available for this story
); } else { diff --git a/src/screens/VisualTests/VisualTests.stories.tsx b/src/screens/VisualTests/VisualTests.stories.tsx index e830e496..0cab7b1c 100644 --- a/src/screens/VisualTests/VisualTests.stories.tsx +++ b/src/screens/VisualTests/VisualTests.stories.tsx @@ -1,4 +1,4 @@ -import { ResultOf } from "@graphql-typed-document-node/core"; +import type { ResultOf } from "@graphql-typed-document-node/core"; import { action } from "@storybook/addon-actions"; import { expect } from "@storybook/jest"; import type { Meta, StoryObj } from "@storybook/react"; @@ -299,9 +299,6 @@ export const NextBuildInProgress: Story = { ...InProgress, parameters: { ...withBuilds({ storyBuild: pendingBuild, nextBuild: { ...inProgressBuild, id: "2" } }), - ...withFigmaDesign( - "https://www.figma.com/file/GFEbCgCVDtbZhngULbw2gP/Visual-testing-in-Storybook?type=design&node-id=508-304861&t=0rxMQnkxsVpVj1qy-4" - ), }, }; @@ -319,7 +316,7 @@ export const NextBuildInProgressCapturedStory: Story = { ), }), ...withFigmaDesign( - "https://www.figma.com/file/GFEbCgCVDtbZhngULbw2gP/Visual-testing-in-Storybook?type=design&node-id=508-304861&t=0rxMQnkxsVpVj1qy-4" + "https://www.figma.com/file/GFEbCgCVDtbZhngULbw2gP/Visual-testing-in-Storybook?type=design&node-id=2303-374529&t=qjmuGHxoALrVuhvX-0" ), }, }; diff --git a/src/screens/VisualTests/VisualTests.tsx b/src/screens/VisualTests/VisualTests.tsx index b190d578..9837e4c9 100644 --- a/src/screens/VisualTests/VisualTests.tsx +++ b/src/screens/VisualTests/VisualTests.tsx @@ -147,7 +147,7 @@ export const VisualTests = ({ const isRunningBuildStarting = !runningBuild || !["success", "error"].includes(runningBuild.step); - const { branch, uncommittedHash } = gitInfo; + const { branch } = gitInfo; return !nextBuild || error ? ( ); From beff39d262d2f8a60b18c1a866aa42bb4cd62358 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 7 Sep 2023 22:13:42 +1000 Subject: [PATCH 2/8] Some fixes --- src/screens/VisualTests/BuildResults.tsx | 8 +++---- .../VisualTests/SnapshotComparison.tsx | 23 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index e3acc2c5..8b1ef9d5 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -80,10 +80,10 @@ export const BuildResults = ({ "testsForStatus" in nextBuild ? nextBuild.testsForStatus.nodes : [] ), ]; - const isStoryOutdated = storyTests.every( - ({ story: { storyId } }) => - nextTests.find((t) => t.story.storyId === storyId).status !== TestStatus.InProgress - ); + const isStoryOutdated = storyTests.every(({ story: { storyId } }) => { + const nextTest = nextTests.find((t) => t.story.storyId === storyId); + return nextTest && nextTest.status !== TestStatus.InProgress; + }); // It shouldn't be possible for one test to be skipped but not all of them const isSkipped = !!storyTests?.find((t) => t.result === TestResult.Skipped); diff --git a/src/screens/VisualTests/SnapshotComparison.tsx b/src/screens/VisualTests/SnapshotComparison.tsx index 51ad895b..ced0713c 100644 --- a/src/screens/VisualTests/SnapshotComparison.tsx +++ b/src/screens/VisualTests/SnapshotComparison.tsx @@ -118,18 +118,17 @@ export const SnapshotComparison = ({ )} - {isAcceptable || - (isUnacceptable && !isReviewable && ( - - } - trigger="hover" - hasChrome={false} - > - - - - ))} + {(isAcceptable || isUnacceptable) && !isReviewable && ( + + } + trigger="hover" + hasChrome={false} + > + + + + )} {isAcceptable && isReviewable && ( <> From 159ce90788887da45baf82ab14205ce76c519f2d Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 7 Sep 2023 22:22:10 +1000 Subject: [PATCH 3/8] Fixes --- src/screens/VisualTests/BuildResults.tsx | 10 +++++--- .../VisualTests/VisualTests.stories.tsx | 25 ------------------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index 8b1ef9d5..86a6a875 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -80,10 +80,12 @@ export const BuildResults = ({ "testsForStatus" in nextBuild ? nextBuild.testsForStatus.nodes : [] ), ]; - const isStoryOutdated = storyTests.every(({ story: { storyId } }) => { - const nextTest = nextTests.find((t) => t.story.storyId === storyId); - return nextTest && nextTest.status !== TestStatus.InProgress; - }); + const isStoryOutdated = + !isReviewable && + storyTests.every(({ story: { storyId } }) => { + const nextTest = nextTests.find((t) => t.story.storyId === storyId); + return nextTest && nextTest.status !== TestStatus.InProgress; + }); // It shouldn't be possible for one test to be skipped but not all of them const isSkipped = !!storyTests?.find((t) => t.result === TestResult.Skipped); diff --git a/src/screens/VisualTests/VisualTests.stories.tsx b/src/screens/VisualTests/VisualTests.stories.tsx index ad5a70e2..16157851 100644 --- a/src/screens/VisualTests/VisualTests.stories.tsx +++ b/src/screens/VisualTests/VisualTests.stories.tsx @@ -237,31 +237,6 @@ export const NoChanges: Story = { }, }; -export const Outdated: Story = { - args: { - gitInfo: { - ...meta.args.gitInfo, - uncommittedHash: "1234abc", - }, - }, - parameters: { - ...withBuilds({ storyBuild: passedBuild }), - ...withFigmaDesign( - "https://www.figma.com/file/GFEbCgCVDtbZhngULbw2gP/Visual-testing-in-Storybook?type=design&node-id=508-304922&t=0rxMQnkxsVpVj1qy-4" - ), - }, -}; - -export const OutdatedStarting: Story = { - ...Outdated, - args: { - ...Outdated.args, - runningBuild: { - step: "initialize", - }, - }, -}; - export const Announced: Story = { args: {}, parameters: { From 36e732cac15ec48e5166385ab678d2bd5613924e Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 7 Sep 2023 22:28:51 +1000 Subject: [PATCH 4/8] Don't show "View latest snapshot" if you can't switch to it --- src/screens/VisualTests/StoryInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/VisualTests/StoryInfo.tsx b/src/screens/VisualTests/StoryInfo.tsx index b5561293..50970414 100644 --- a/src/screens/VisualTests/StoryInfo.tsx +++ b/src/screens/VisualTests/StoryInfo.tsx @@ -76,7 +76,7 @@ export const StoryInfo = ({ ); - } else if (isStoryOutdated) { + } else if (isStoryOutdated && switchToNextBuild) { details = ( From 16e7e7ee664563d193fe22a684cc3882a7a3f7d4 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 7 Sep 2023 22:31:30 +1000 Subject: [PATCH 5/8] One more smal fix from merging --- src/screens/VisualTests/SnapshotComparison.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/screens/VisualTests/SnapshotComparison.tsx b/src/screens/VisualTests/SnapshotComparison.tsx index ced0713c..1d04c2c7 100644 --- a/src/screens/VisualTests/SnapshotComparison.tsx +++ b/src/screens/VisualTests/SnapshotComparison.tsx @@ -138,7 +138,11 @@ export const SnapshotComparison = ({ trigger="hover" hasChrome={false} > - onAccept(selectedTest.id)}> + onAccept(selectedTest.id)} + > Accept From 836abdfe0c6c801e143c3c9c3503ec0b1eaff3dc Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 7 Sep 2023 22:40:48 +1000 Subject: [PATCH 6/8] Fix logic of checking if a story is outdated --- src/gql/gql.ts | 9 +++++++-- src/gql/graphql.ts | 13 +++++++++++-- src/screens/VisualTests/BuildResults.tsx | 14 +++++--------- src/screens/VisualTests/graphql.ts | 16 ++++++++++++++++ 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/gql/gql.ts b/src/gql/gql.ts index fcbb4dfa..0a19b5c4 100644 --- a/src/gql/gql.ts +++ b/src/gql/gql.ts @@ -16,9 +16,10 @@ 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 $projectId: ID!\n $branch: String!\n $gitUserEmailHash: String!\n $slug: String\n $storyId: String!\n $testStatuses: [TestStatus!]!\n $storyBuildId: ID!\n $hasStoryBuildId: Boolean!\n ) {\n project(id: $projectId) {\n name\n nextBuild: lastBuild(\n branches: [$branch]\n slug: $slug\n localBuilds: { localBuildEmailHash: $gitUserEmailHash }\n ) {\n ...NextBuildFields\n ...StoryBuildFields @skip(if: $hasStoryBuildId)\n }\n }\n storyBuild: build(id: $storyBuildId) @include(if: $hasStoryBuildId) {\n ...StoryBuildFields\n }\n }\n": types.AddonVisualTestsBuildDocument, - "\n fragment NextBuildFields on Build {\n __typename\n id\n committedAt\n ... on StartedBuild {\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n }\n }\n": types.NextBuildFieldsFragmentDoc, + "\n fragment NextBuildFields on Build {\n __typename\n id\n committedAt\n ... on StartedBuild {\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...NextStoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...NextStoryTestFields\n }\n }\n }\n }\n": types.NextBuildFieldsFragmentDoc, "\n fragment StoryBuildFields on Build {\n __typename\n id\n number\n branch\n committedAt\n uncommittedHash\n status\n ... on StartedBuild {\n startedAt\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n startedAt\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...StoryTestFields\n }\n }\n }\n }\n": types.StoryBuildFieldsFragmentDoc, "\n fragment StatusTestFields on Test {\n id\n status\n story {\n storyId\n }\n }\n": types.StatusTestFieldsFragmentDoc, + "\n fragment NextStoryTestFields on Test {\n status\n }\n": types.NextStoryTestFieldsFragmentDoc, "\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 imageWidth\n }\n }\n headCapture {\n captureImage {\n imageUrl\n imageWidth\n }\n captureError {\n kind\n ... on CaptureErrorInteractionFailure {\n error\n }\n ... on CaptureErrorJSError {\n error\n }\n ... on CaptureErrorFailedJS {\n error\n }\n }\n }\n baseCapture {\n captureImage {\n imageUrl\n imageWidth\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 name\n component {\n name\n }\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, }; @@ -52,7 +53,7 @@ export function graphql(source: "\n query AddonVisualTestsBuild(\n $projectI /** * 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 NextBuildFields on Build {\n __typename\n id\n committedAt\n ... on StartedBuild {\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n }\n }\n"): (typeof documents)["\n fragment NextBuildFields on Build {\n __typename\n id\n committedAt\n ... on StartedBuild {\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n }\n }\n"]; +export function graphql(source: "\n fragment NextBuildFields on Build {\n __typename\n id\n committedAt\n ... on StartedBuild {\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...NextStoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...NextStoryTestFields\n }\n }\n }\n }\n"): (typeof documents)["\n fragment NextBuildFields on Build {\n __typename\n id\n committedAt\n ... on StartedBuild {\n testsForStatus: tests(first: 1000, statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...NextStoryTestFields\n }\n }\n }\n ... on CompletedBuild {\n result\n testsForStatus: tests(statuses: $testStatuses) {\n nodes {\n ...StatusTestFields\n }\n }\n testsForStory: tests(storyId: $storyId) {\n nodes {\n ...NextStoryTestFields\n }\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -61,6 +62,10 @@ export function graphql(source: "\n fragment StoryBuildFields on Build {\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 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 NextStoryTestFields on Test {\n status\n }\n"): (typeof documents)["\n fragment NextStoryTestFields on Test {\n status\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/src/gql/graphql.ts b/src/gql/graphql.ts index d9fabaea..98907c08 100644 --- a/src/gql/graphql.ts +++ b/src/gql/graphql.ts @@ -1391,6 +1391,9 @@ type NextBuildFields_AnnouncedBuild_Fragment = { __typename: 'AnnouncedBuild', i type NextBuildFields_CompletedBuild_Fragment = { __typename: 'CompletedBuild', result: BuildResult, id: string, committedAt: any, testsForStatus?: { __typename?: 'CompletedBuildTestConnection', nodes: Array<( { __typename?: 'Test' } & { ' $fragmentRefs'?: { 'StatusTestFieldsFragment': StatusTestFieldsFragment } } + )> } | null, testsForStory?: { __typename?: 'CompletedBuildTestConnection', nodes: Array<( + { __typename?: 'Test' } + & { ' $fragmentRefs'?: { 'NextStoryTestFieldsFragment': NextStoryTestFieldsFragment } } )> } | null } & { ' $fragmentName'?: 'NextBuildFields_CompletedBuild_Fragment' }; type NextBuildFields_PreparedBuild_Fragment = { __typename: 'PreparedBuild', id: string, committedAt: any } & { ' $fragmentName'?: 'NextBuildFields_PreparedBuild_Fragment' }; @@ -1400,6 +1403,9 @@ type NextBuildFields_PublishedBuild_Fragment = { __typename: 'PublishedBuild', i type NextBuildFields_StartedBuild_Fragment = { __typename: 'StartedBuild', id: string, committedAt: any, testsForStatus?: { __typename?: 'StartedBuildTestConnection', nodes: Array<( { __typename?: 'Test' } & { ' $fragmentRefs'?: { 'StatusTestFieldsFragment': StatusTestFieldsFragment } } + )> } | null, testsForStory?: { __typename?: 'StartedBuildTestConnection', nodes: Array<( + { __typename?: 'Test' } + & { ' $fragmentRefs'?: { 'NextStoryTestFieldsFragment': NextStoryTestFieldsFragment } } )> } | null } & { ' $fragmentName'?: 'NextBuildFields_StartedBuild_Fragment' }; export type NextBuildFieldsFragment = NextBuildFields_AnnouncedBuild_Fragment | NextBuildFields_CompletedBuild_Fragment | NextBuildFields_PreparedBuild_Fragment | NextBuildFields_PublishedBuild_Fragment | NextBuildFields_StartedBuild_Fragment; @@ -1424,6 +1430,8 @@ export type StoryBuildFieldsFragment = StoryBuildFields_AnnouncedBuild_Fragment export type StatusTestFieldsFragment = { __typename?: 'Test', id: string, status: TestStatus, story?: { __typename?: 'Story', storyId: string } | null } & { ' $fragmentName'?: 'StatusTestFieldsFragment' }; +export type NextStoryTestFieldsFragment = { __typename?: 'Test', status: TestStatus } & { ' $fragmentName'?: 'NextStoryTestFieldsFragment' }; + export type StoryTestFieldsFragment = { __typename?: 'Test', id: string, status: TestStatus, result?: TestResult | null, webUrl: any, comparisons: Array<{ __typename?: 'TestComparison', id: string, result?: ComparisonResult | null, browser: { __typename?: 'BrowserInfo', id: string, key: Browser, name: string, version: string }, captureDiff?: { __typename?: 'CaptureDiff', diffImage?: { __typename?: 'CaptureOverlayImage', imageUrl: any, imageWidth: number } | null } | null, headCapture?: { __typename?: 'Capture', captureImage?: { __typename?: 'CaptureImage', imageUrl: any, imageWidth: number } | null, captureError?: { __typename?: 'CaptureErrorComponentOffPage', kind: CaptureErrorKind } | { __typename?: 'CaptureErrorFailedJS', error: any, kind: CaptureErrorKind } | { __typename?: 'CaptureErrorImageTooLarge', kind: CaptureErrorKind } | { __typename?: 'CaptureErrorInteractionFailure', error: any, kind: CaptureErrorKind } | { __typename?: 'CaptureErrorJSError', error: any, kind: CaptureErrorKind } | { __typename?: 'CaptureErrorNavigationTimeout', kind: CaptureErrorKind } | { __typename?: 'CaptureErrorNoJS', kind: CaptureErrorKind } | { __typename?: 'CaptureErrorStoryMissing', kind: CaptureErrorKind } | null } | null, baseCapture?: { __typename?: 'Capture', captureImage?: { __typename?: 'CaptureImage', imageUrl: any, imageWidth: number } | null } | null, viewport: { __typename?: 'ViewportInfo', id: string, name: string, width: number, isDefault: boolean } }>, parameters: { __typename?: 'TestParameters', viewport: { __typename?: 'ViewportInfo', id: string, name: string, width: number, isDefault: boolean } }, story?: { __typename?: 'Story', storyId: string, name: string, component?: { __typename?: 'Component', name: string } | null } | null } & { ' $fragmentName'?: 'StoryTestFieldsFragment' }; export type ReviewTestMutationVariables = Exact<{ @@ -1434,10 +1442,11 @@ export type ReviewTestMutationVariables = Exact<{ export type ReviewTestMutation = { __typename?: 'Mutation', reviewTest?: { __typename?: 'ReviewTestPayload', updatedTests?: Array<{ __typename?: 'Test', id: string, status: TestStatus }> | null, userErrors: Array<{ __typename: 'BuildSupersededError', message: string, build: { __typename?: 'AnnouncedBuild', id: string } | { __typename?: 'CompletedBuild', id: string } | { __typename?: 'PreparedBuild', id: string } | { __typename?: 'PublishedBuild', id: string } | { __typename?: 'StartedBuild', id: string } } | { __typename: 'TestNotFoundError', message: string } | { __typename: 'TestUnreviewableError', message: string, test: { __typename?: 'Test', id: string } }> } | null }; export const StatusTestFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StatusTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}}]}}]}}]} as unknown as DocumentNode; -export const NextBuildFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"1000"}},{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StatusTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}}]}}]}}]} as unknown as DocumentNode; +export const NextStoryTestFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextStoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]} as unknown as DocumentNode; +export const NextBuildFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"1000"}},{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NextStoryTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NextStoryTestFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StatusTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextStoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]} as unknown as DocumentNode; export const StoryTestFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"webUrl"}},{"kind":"Field","name":{"kind":"Name","value":"comparisons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"browser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"version"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureDiff"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"diffImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"headCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureError"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorInteractionFailure"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorJSError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorFailedJS"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"baseCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"parameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"component"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; export const StoryBuildFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"branch"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"Field","name":{"kind":"Name","value":"uncommittedHash"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryTestFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"webUrl"}},{"kind":"Field","name":{"kind":"Name","value":"comparisons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"browser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"version"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureDiff"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"diffImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"headCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureError"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorInteractionFailure"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorJSError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorFailedJS"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"baseCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"parameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"component"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; export const SelectProjectsQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SelectProjectsQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}},{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"webUrl"}},{"kind":"Field","name":{"kind":"Name","value":"projectToken"}},{"kind":"Field","name":{"kind":"Name","value":"lastBuild"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"branch"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const ProjectQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ProjectQuery"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"project"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"webUrl"}},{"kind":"Field","name":{"kind":"Name","value":"lastBuild"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"branch"}},{"kind":"Field","name":{"kind":"Name","value":"number"}}]}}]}}]}}]} as unknown as DocumentNode; -export const AddonVisualTestsBuildDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AddonVisualTestsBuild"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"branch"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"gitUserEmailHash"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TestStatus"}}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"storyBuildId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"hasStoryBuildId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"project"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"nextBuild"},"name":{"kind":"Name","value":"lastBuild"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"branches"},"value":{"kind":"ListValue","values":[{"kind":"Variable","name":{"kind":"Name","value":"branch"}}]}},{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}},{"kind":"Argument","name":{"kind":"Name","value":"localBuilds"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"localBuildEmailHash"},"value":{"kind":"Variable","name":{"kind":"Name","value":"gitUserEmailHash"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NextBuildFields"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryBuildFields"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"skip"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"if"},"value":{"kind":"Variable","name":{"kind":"Name","value":"hasStoryBuildId"}}}]}]}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"storyBuild"},"name":{"kind":"Name","value":"build"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyBuildId"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"include"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"if"},"value":{"kind":"Variable","name":{"kind":"Name","value":"hasStoryBuildId"}}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryBuildFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StatusTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"webUrl"}},{"kind":"Field","name":{"kind":"Name","value":"comparisons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"browser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"version"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureDiff"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"diffImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"headCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureError"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorInteractionFailure"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorJSError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorFailedJS"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"baseCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"parameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"component"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"1000"}},{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"branch"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"Field","name":{"kind":"Name","value":"uncommittedHash"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryTestFields"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const AddonVisualTestsBuildDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AddonVisualTestsBuild"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"branch"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"gitUserEmailHash"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TestStatus"}}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"storyBuildId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"hasStoryBuildId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"project"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","alias":{"kind":"Name","value":"nextBuild"},"name":{"kind":"Name","value":"lastBuild"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"branches"},"value":{"kind":"ListValue","values":[{"kind":"Variable","name":{"kind":"Name","value":"branch"}}]}},{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}},{"kind":"Argument","name":{"kind":"Name","value":"localBuilds"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"localBuildEmailHash"},"value":{"kind":"Variable","name":{"kind":"Name","value":"gitUserEmailHash"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NextBuildFields"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryBuildFields"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"skip"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"if"},"value":{"kind":"Variable","name":{"kind":"Name","value":"hasStoryBuildId"}}}]}]}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"storyBuild"},"name":{"kind":"Name","value":"build"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyBuildId"}}}],"directives":[{"kind":"Directive","name":{"kind":"Name","value":"include"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"if"},"value":{"kind":"Variable","name":{"kind":"Name","value":"hasStoryBuildId"}}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryBuildFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StatusTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextStoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryTestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Test"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"webUrl"}},{"kind":"Field","name":{"kind":"Name","value":"comparisons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"browser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"version"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureDiff"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"diffImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"headCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}},{"kind":"Field","name":{"kind":"Name","value":"captureError"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"kind"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorInteractionFailure"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorJSError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CaptureErrorFailedJS"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"error"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"baseCapture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"captureImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"imageWidth"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"parameters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewport"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"story"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"storyId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"component"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"NextBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"IntValue","value":"1000"}},{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NextStoryTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStatus"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"statuses"},"value":{"kind":"Variable","name":{"kind":"Name","value":"testStatuses"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StatusTestFields"}}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"NextStoryTestFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StoryBuildFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Build"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"number"}},{"kind":"Field","name":{"kind":"Name","value":"branch"}},{"kind":"Field","name":{"kind":"Name","value":"committedAt"}},{"kind":"Field","name":{"kind":"Name","value":"uncommittedHash"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StartedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryTestFields"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CompletedBuild"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"testsForStory"},"name":{"kind":"Name","value":"tests"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"storyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"storyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StoryTestFields"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const ReviewTestDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ReviewTest"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ReviewTestInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"reviewTest"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatedTests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"Field","name":{"kind":"Name","value":"userErrors"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"UserError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BuildSupersededError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"build"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TestUnreviewableError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index 86a6a875..54502fff 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -19,7 +19,7 @@ import { TestStatus, } from "../../gql/graphql"; import { BuildProgress } from "./BuildProgress"; -import { FragmentStatusTestFields, FragmentStoryTestFields } from "./graphql"; +import { FragmentNextStoryTestFields, FragmentStoryTestFields } from "./graphql"; import { RenderSettings } from "./RenderSettings"; import { SnapshotComparison } from "./SnapshotComparison"; import { StoryInfo } from "./StoryInfo"; @@ -74,18 +74,14 @@ export const BuildResults = ({ "testsForStory" in storyBuild ? storyBuild.testsForStory.nodes : [] ), ]; - const nextTests = [ + const nextStoryTests = [ ...getFragment( - FragmentStatusTestFields, - "testsForStatus" in nextBuild ? nextBuild.testsForStatus.nodes : [] + FragmentNextStoryTestFields, + "testsForStory" in nextBuild ? nextBuild.testsForStory.nodes : [] ), ]; const isStoryOutdated = - !isReviewable && - storyTests.every(({ story: { storyId } }) => { - const nextTest = nextTests.find((t) => t.story.storyId === storyId); - return nextTest && nextTest.status !== TestStatus.InProgress; - }); + !isReviewable && nextStoryTests.every(({ status }) => status !== TestStatus.InProgress); // It shouldn't be possible for one test to be skipped but not all of them const isSkipped = !!storyTests?.find((t) => t.result === TestResult.Skipped); diff --git a/src/screens/VisualTests/graphql.ts b/src/screens/VisualTests/graphql.ts index e14defbb..008ce3d7 100644 --- a/src/screens/VisualTests/graphql.ts +++ b/src/screens/VisualTests/graphql.ts @@ -39,6 +39,11 @@ export const FragmentNextBuildFields = graphql(/* GraphQL */ ` ...StatusTestFields } } + testsForStory: tests(storyId: $storyId) { + nodes { + ...NextStoryTestFields + } + } } ... on CompletedBuild { result @@ -47,6 +52,11 @@ export const FragmentNextBuildFields = graphql(/* GraphQL */ ` ...StatusTestFields } } + testsForStory: tests(storyId: $storyId) { + nodes { + ...NextStoryTestFields + } + } } } `); @@ -89,6 +99,12 @@ export const FragmentStatusTestFields = graphql(/* GraphQL */ ` } `); +export const FragmentNextStoryTestFields = graphql(/* GraphQL */ ` + fragment NextStoryTestFields on Test { + status + } +`); + export const FragmentStoryTestFields = graphql(/* GraphQL */ ` fragment StoryTestFields on Test { id From 8eb9e6937b95d6263af8cfd05f74ee8c09621efc Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 12 Sep 2023 12:10:16 +1000 Subject: [PATCH 7/8] Rename "outdated" to "superseded" --- src/screens/VisualTests/BuildResults.tsx | 4 ++-- src/screens/VisualTests/StoryInfo.stories.ts | 18 +++++++++--------- src/screens/VisualTests/StoryInfo.tsx | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index 54502fff..ac066281 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -80,7 +80,7 @@ export const BuildResults = ({ "testsForStory" in nextBuild ? nextBuild.testsForStory.nodes : [] ), ]; - const isStoryOutdated = + const isStorySuperseded = !isReviewable && nextStoryTests.every(({ status }) => status !== TestStatus.InProgress); // It shouldn't be possible for one test to be skipped but not all of them @@ -135,7 +135,7 @@ export const BuildResults = ({ isStarting: isStoryBuildStarting, startDevBuild, isBuildFailed, - isStoryOutdated, + isStorySuperseded, switchToNextBuild, }} /> diff --git a/src/screens/VisualTests/StoryInfo.stories.ts b/src/screens/VisualTests/StoryInfo.stories.ts index 9cf56bf2..b5d787be 100644 --- a/src/screens/VisualTests/StoryInfo.stories.ts +++ b/src/screens/VisualTests/StoryInfo.stories.ts @@ -11,7 +11,7 @@ const meta = { isStarting: false, startedAt: new Date(Date.now() - 1000 * 60 * 2), // 2 minutes ago startDevBuild: action("startDevBuild"), - isStoryOutdated: false, + isStorySuperseded: false, isBuildFailed: false, }, } satisfies Meta; @@ -28,12 +28,12 @@ export const Announced: Story = { args: { isStarting: true, startedAt: null }, }; -// The build hasn't start properly yet but is already out of date -export const AnnouncedOutdated: Story = { +// The build hasn't start properly yet but is already superseded by another build +export const AnnouncedSuperseded: Story = { ...Announced, args: { ...Announced.args, - isStoryOutdated: true, + isStorySuperseded: true, switchToNextBuild: action("switchToNextBuild"), }, }; @@ -43,17 +43,17 @@ export const FailedAnnounced: Story = { args: { isBuildFailed: true }, }; -// The build hasn't finished yet but is already out of date +// The build hasn't finished yet but is already superseded by another build export const InProgress: Story = { args: { tests: [makeTest({ status: TestStatus.InProgress })], }, }; -export const InProgressOutdated: Story = { +export const InProgressSuperseded: Story = { args: { tests: [makeTest({ status: TestStatus.InProgress })], - isStoryOutdated: true, + isStorySuperseded: true, switchToNextBuild: action("switchToNextBuild"), }, }; @@ -64,11 +64,11 @@ export const Pending: Story = { }, }; -export const PendingOutdated: Story = { +export const PendingSuperseded: Story = { ...Pending, args: { ...Pending.args, - isStoryOutdated: true, + isStorySuperseded: true, switchToNextBuild: action("switchToNextBuild"), }, }; diff --git a/src/screens/VisualTests/StoryInfo.tsx b/src/screens/VisualTests/StoryInfo.tsx index 50970414..2088acaa 100644 --- a/src/screens/VisualTests/StoryInfo.tsx +++ b/src/screens/VisualTests/StoryInfo.tsx @@ -23,7 +23,7 @@ interface StoryInfoSectionProps { /** Did the build fail entirely? */ isBuildFailed: boolean; /** is the story we are looking at already replaced by a completed capture on the next build? */ - isStoryOutdated: boolean; + isStorySuperseded: boolean; /** Select the next build if it isn't this build */ switchToNextBuild?: () => void; } @@ -34,7 +34,7 @@ export const StoryInfo = ({ startedAt, startDevBuild, isBuildFailed, - isStoryOutdated, + isStorySuperseded, switchToNextBuild, }: StoryInfoSectionProps) => { // isInProgress means we have tests but they are still unfinished @@ -76,7 +76,7 @@ export const StoryInfo = ({ ); - } else if (isStoryOutdated && switchToNextBuild) { + } else if (isStorySuperseded && switchToNextBuild) { details = ( From fc95b12310796e3b100a0a5ccc6d12ecb3bbbb0e Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Tue, 12 Sep 2023 12:19:50 +1000 Subject: [PATCH 8/8] Don't show eyebrow unnecessarily If the `StoryInfo` is already going to prompt you to switch, there's no point in redundantly showing you also in the eyebrow: https://www.chromatic.com/review?appId=6480e1b0042842f149cfd74c&number=87&activeElementId=comment-thread-64ff2a5781851ff6d5e44492 --- src/screens/VisualTests/BuildResults.tsx | 28 ++++++++++++------------ src/screens/VisualTests/VisualTests.tsx | 8 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index b3823d84..513da28f 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -31,7 +31,6 @@ interface BuildResultsProps { nextBuild: NextBuildFieldsFragment; switchToNextBuild?: () => void; startDevBuild: () => void; - isOutdated: boolean; isReviewing: boolean; onAccept: (testId: string, batch: ReviewTestBatch) => Promise; onUnaccept: (testId: string) => Promise; @@ -43,7 +42,6 @@ export const BuildResults = ({ nextBuild, switchToNextBuild, startDevBuild, - isOutdated, isReviewing, onAccept, onUnaccept, @@ -57,18 +55,6 @@ export const BuildResults = ({ const isRunningBuildInProgress = runningBuild && runningBuild.step !== "complete"; const isReviewable = nextBuild.id === storyBuild.id; - const showBuildStatus = - // We always want to show the status of the running build (until it is done) - isRunningBuildInProgress || - // Even if there's no build running, we want to show the next build if it hasn't been selected. - !isReviewable; - const runningBuildIsNextBuild = runningBuild && runningBuild?.buildId === nextBuild.id; - const buildStatus = showBuildStatus && ( - - ); const storyTests = [ ...getFragment( @@ -85,6 +71,20 @@ export const BuildResults = ({ const isStorySuperseded = !isReviewable && nextStoryTests.every(({ status }) => status !== TestStatus.InProgress); + const showBuildStatus = + // We always want to show the status of the running build (until it is done) + isRunningBuildInProgress || + // Even if there's no build running, we want to show the next build if it hasn't been selected, + // unless the story info itself is going to tell us to switch already + (!isReviewable && !(isStorySuperseded && switchToNextBuild)); + const runningBuildIsNextBuild = runningBuild && runningBuild?.buildId === nextBuild.id; + const buildStatus = showBuildStatus && ( + + ); + // It shouldn't be possible for one test to be skipped but not all of them const isSkipped = !!storyTests?.find((t) => t.result === TestResult.Skipped); if (isSkipped) { diff --git a/src/screens/VisualTests/VisualTests.tsx b/src/screens/VisualTests/VisualTests.tsx index f580deb3..1204d90f 100644 --- a/src/screens/VisualTests/VisualTests.tsx +++ b/src/screens/VisualTests/VisualTests.tsx @@ -139,6 +139,10 @@ export const VisualTests = ({ data?.storyBuild ?? data?.project?.nextBuild ); + // Currently only used by the sidebar button to show a blue dot ("build outdated") + const isOutdated = storyBuild?.uncommittedHash !== gitInfo.uncommittedHash; + useEffect(() => setOutdated(isOutdated), [isOutdated, setOutdated]); + // If the next build is *newer* than the current commit, we don't want to switch to the build const nextBuildNewer = nextBuild && nextBuild.committedAt > gitInfo.committedAt; const canSwitchToNextBuild = nextBuild && !nextBuildNewer; @@ -178,9 +182,6 @@ export const VisualTests = ({ ); const isRunningBuildStarting = runningBuild && !["success", "error"].includes(runningBuild.step); - const isOutdated = storyBuild?.uncommittedHash !== gitInfo.uncommittedHash; - - useEffect(() => setOutdated(isOutdated), [isOutdated, setOutdated]); return !nextBuild || error ? (