Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display sensitivity threshold #1342

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/backend/src/graphql/__generated__/resolver-types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions apps/backend/src/graphql/__generated__/schema.gql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 18 additions & 13 deletions apps/backend/src/graphql/definitions/ScreenshotDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const typeDefs = gql`
flakyDetected: Boolean! @deprecated(reason: "Remove in future release")
test: Test @deprecated(reason: "Remove in future release")
group: String
threshold: Float
}

type ScreenshotDiffConnection implements Connection {
Expand Down Expand Up @@ -76,19 +77,19 @@ export const resolvers: IResolvers = {
invariant(name, "screenshot diff without name");
return name;
},
width: async (screenshot, _args, ctx) => {
if (!screenshot.fileId) {
width: async (screenshotDiff, _args, ctx) => {
if (!screenshotDiff.fileId) {
return null;
}
const file = await ctx.loaders.File.load(screenshot.fileId);
const file = await ctx.loaders.File.load(screenshotDiff.fileId);
invariant(file, "File not found");
return file.width;
},
height: async (screenshot, _args, ctx) => {
if (!screenshot.fileId) {
height: async (screenshotDiff, _args, ctx) => {
if (!screenshotDiff.fileId) {
return null;
}
const file = await ctx.loaders.File.load(screenshot.fileId);
const file = await ctx.loaders.File.load(screenshotDiff.fileId);
invariant(file, "File not found");
return file.height;
},
Expand All @@ -101,13 +102,17 @@ export const resolvers: IResolvers = {

return diffStatus as IScreenshotDiffStatus;
},
// @TODO: Remove in future release
flakyDetected: () => {
return false;
},
// @TODO: Remove in future release
test: async () => {
return null;
threshold: async (screenshotDiff, _args, ctx) => {
if (
!screenshotDiff.compareScreenshotId ||
!screenshotDiff.baseScreenshotId
) {
return null;
}
const compareScreenshot = await ctx.loaders.Screenshot.load(
screenshotDiff.compareScreenshotId,
);
return compareScreenshot?.threshold ?? null;
},
},
};
4 changes: 2 additions & 2 deletions apps/frontend/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const documents = {
"\n query AccountSettings_account($slug: String!) {\n account(slug: $slug) {\n id\n\n ... on Team {\n plan {\n id\n fineGrainedAccessControlIncluded\n }\n }\n\n ...TeamSlack_Account\n ...TeamMembers_Team\n ...TeamDelete_Team\n ...AccountChangeName_Account\n ...AccountChangeSlug_Account\n ...PlanCard_Account\n ...AccountGitLab_Account\n ...TeamGitHubSSO_Team\n ...TeamAccessRole_Team\n }\n }\n": types.AccountSettings_AccountDocument,
"\n query Account_account($slug: String!) {\n account(slug: $slug) {\n id\n slug\n permissions\n ...PaymentBanner_Account\n }\n }\n": types.Account_AccountDocument,
"\n fragment BuildDetail_Build on Build {\n id\n stats {\n total\n }\n createdAt\n branch\n type\n baseScreenshotBucket {\n id\n branch\n createdAt\n }\n pullRequest {\n merged\n }\n }\n": types.BuildDetail_BuildFragmentDoc,
"\n fragment BuildDiffState_ScreenshotDiff on ScreenshotDiff {\n id\n status\n url\n name\n width\n height\n group\n baseScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n }\n compareScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n playwrightTraceUrl\n }\n }\n": types.BuildDiffState_ScreenshotDiffFragmentDoc,
"\n fragment BuildDiffState_ScreenshotDiff on ScreenshotDiff {\n id\n status\n url\n name\n width\n height\n group\n threshold\n baseScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n }\n compareScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n playwrightTraceUrl\n }\n }\n": types.BuildDiffState_ScreenshotDiffFragmentDoc,
"\n query BuildDiffState_Project(\n $accountSlug: String!\n $projectName: String!\n $buildNumber: Int!\n $after: Int!\n $first: Int!\n ) {\n project(accountSlug: $accountSlug, projectName: $projectName) {\n id\n build(number: $buildNumber) {\n id\n screenshotDiffs(after: $after, first: $first) {\n pageInfo {\n hasNextPage\n }\n edges {\n ...BuildDiffState_ScreenshotDiff\n }\n }\n }\n }\n }\n": types.BuildDiffState_ProjectDocument,
"\n fragment BuildDiffState_Build on Build {\n id\n stats {\n ...BuildStatsIndicator_BuildStats\n total\n failure\n changed\n added\n removed\n unchanged\n retryFailure\n }\n }\n": types.BuildDiffState_BuildFragmentDoc,
"\n fragment BuildInfos_Build on Build {\n createdAt\n name\n commit\n branch\n mode\n stats {\n total\n }\n baseScreenshotBucket {\n id\n commit\n branch\n }\n baseBuild {\n id\n number\n }\n pullRequest {\n id\n url\n number\n }\n }\n": types.BuildInfos_BuildFragmentDoc,
Expand Down Expand Up @@ -515,7 +515,7 @@ export function graphql(source: "\n fragment BuildDetail_Build 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 BuildDiffState_ScreenshotDiff on ScreenshotDiff {\n id\n status\n url\n name\n width\n height\n group\n baseScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n }\n compareScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n playwrightTraceUrl\n }\n }\n"): (typeof documents)["\n fragment BuildDiffState_ScreenshotDiff on ScreenshotDiff {\n id\n status\n url\n name\n width\n height\n group\n baseScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n }\n compareScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n playwrightTraceUrl\n }\n }\n"];
export function graphql(source: "\n fragment BuildDiffState_ScreenshotDiff on ScreenshotDiff {\n id\n status\n url\n name\n width\n height\n group\n threshold\n baseScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n }\n compareScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n playwrightTraceUrl\n }\n }\n"): (typeof documents)["\n fragment BuildDiffState_ScreenshotDiff on ScreenshotDiff {\n id\n status\n url\n name\n width\n height\n group\n threshold\n baseScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n }\n compareScreenshot {\n id\n url\n width\n height\n metadata {\n url\n colorScheme\n mediaType\n automationLibrary {\n name\n version\n }\n browser {\n name\n version\n }\n sdk {\n name\n version\n }\n viewport {\n width\n height\n }\n test {\n id\n title\n titlePath\n location {\n file\n line\n }\n retry\n retries\n }\n }\n playwrightTraceUrl\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