From 249c16dd9e2124cbc543dda98dab526a1385a326 Mon Sep 17 00:00:00 2001 From: Benjamin Karran Date: Tue, 28 May 2024 12:07:06 +0200 Subject: [PATCH 1/4] Remove deprecated API mutations --- visual-js/visual/src/api.ts | 2 -- .../visual/src/documents/webdriverSession.graphql | 9 --------- visual-js/visual/src/graphql/__generated__/gql.ts | 5 ----- visual-js/visual/src/graphql/__generated__/graphql.ts | 10 +--------- 4 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 visual-js/visual/src/documents/webdriverSession.graphql diff --git a/visual-js/visual/src/api.ts b/visual-js/visual/src/api.ts index df03b2ce..f4c68ec7 100644 --- a/visual-js/visual/src/api.ts +++ b/visual-js/visual/src/api.ts @@ -28,7 +28,6 @@ import { DiffsForTestResultDocument, FinishBuildDocumentDocument, UpdateDiffDocument, - WebdriverSessionDocument, WebdriverSessionInfoDocument, BuildWithDiffsByCustomIdDocument, BuildByCustomIdDocument, @@ -111,7 +110,6 @@ export const getApi = ( apollo, CreateSnapshotFromWebDriverDocument, ), - webdriverSession: makeQuery(apollo, WebdriverSessionDocument), webdriverSessionInfo: makeQuery(apollo, WebdriverSessionInfoDocument), build: makeQuery(apollo, BuildDocument), buildByCustomId: makeQuery(apollo, BuildByCustomIdDocument), diff --git a/visual-js/visual/src/documents/webdriverSession.graphql b/visual-js/visual/src/documents/webdriverSession.graphql deleted file mode 100644 index 42c7fe13..00000000 --- a/visual-js/visual/src/documents/webdriverSession.graphql +++ /dev/null @@ -1,9 +0,0 @@ -query webdriverSession($input: ID!) { - result: webdriverSession(sessionId: $input) { - blob - operatingSystem - operatingSystemVersion - browser - browserVersion - } -} diff --git a/visual-js/visual/src/graphql/__generated__/gql.ts b/visual-js/visual/src/graphql/__generated__/gql.ts index 59d277eb..477a4c6d 100644 --- a/visual-js/visual/src/graphql/__generated__/gql.ts +++ b/visual-js/visual/src/graphql/__generated__/gql.ts @@ -26,7 +26,6 @@ const documents = { "query diffsForTestResult($input: UUID!) {\n result: diffs(condition: {buildId: $input}) {\n nodes {\n id\n status\n }\n }\n}": types.DiffsForTestResultDocument, "mutation FinishBuildDocument($input: FinishBuildIn!) {\n result: finishBuild(input: $input) {\n id\n name\n status\n url\n }\n}": types.FinishBuildDocumentDocument, "mutation UpdateDiff($input: UpdateDiffIn!) {\n result: updateDiff(input: $input) {\n id\n status\n baselineId\n snapshotId\n }\n}": types.UpdateDiffDocument, - "query webdriverSession($input: ID!) {\n result: webdriverSession(sessionId: $input) {\n blob\n operatingSystem\n operatingSystemVersion\n browser\n browserVersion\n }\n}": types.WebdriverSessionDocument, "query webdriverSessionInfo($input: WebdriverSessionInfoIn!) {\n result: webdriverSessionInfo(input: $input) {\n blob\n operatingSystem\n operatingSystemVersion\n browser\n browserVersion\n deviceName\n }\n}": types.WebdriverSessionInfoDocument, }; @@ -96,10 +95,6 @@ export function graphql(source: "mutation FinishBuildDocument($input: FinishBuil * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql(source: "mutation UpdateDiff($input: UpdateDiffIn!) {\n result: updateDiff(input: $input) {\n id\n status\n baselineId\n snapshotId\n }\n}"): (typeof documents)["mutation UpdateDiff($input: UpdateDiffIn!) {\n result: updateDiff(input: $input) {\n id\n status\n baselineId\n snapshotId\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: "query webdriverSession($input: ID!) {\n result: webdriverSession(sessionId: $input) {\n blob\n operatingSystem\n operatingSystemVersion\n browser\n browserVersion\n }\n}"): (typeof documents)["query webdriverSession($input: ID!) {\n result: webdriverSession(sessionId: $input) {\n blob\n operatingSystem\n operatingSystemVersion\n browser\n browserVersion\n }\n}"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/visual-js/visual/src/graphql/__generated__/graphql.ts b/visual-js/visual/src/graphql/__generated__/graphql.ts index adeeca65..652056cc 100644 --- a/visual-js/visual/src/graphql/__generated__/graphql.ts +++ b/visual-js/visual/src/graphql/__generated__/graphql.ts @@ -1472,13 +1472,6 @@ export type UpdateDiffMutationVariables = Exact<{ export type UpdateDiffMutation = { __typename?: 'Mutation', result: { __typename?: 'Diff', id: any, status: DiffStatus, baselineId: any | null, snapshotId: any } }; -export type WebdriverSessionQueryVariables = Exact<{ - input: Scalars['ID']; -}>; - - -export type WebdriverSessionQuery = { __typename?: 'Query', result: { __typename?: 'WebdriverSession', blob: string, operatingSystem: OperatingSystem | null, operatingSystemVersion: string | null, browser: Browser | null, browserVersion: string | null } | null }; - export type WebdriverSessionInfoQueryVariables = Exact<{ input: WebdriverSessionInfoIn; }>; @@ -1500,5 +1493,4 @@ export const CreateSnapshotUploadFromWebDriverDocument = {"kind":"Document","def export const DiffsForTestResultDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"diffsForTestResult"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"result"},"name":{"kind":"Name","value":"diffs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"condition"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"buildId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]}}]} as unknown as DocumentNode; export const FinishBuildDocumentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"FinishBuildDocument"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"FinishBuildIn"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"result"},"name":{"kind":"Name","value":"finishBuild"},"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":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode; export const UpdateDiffDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateDiff"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateDiffIn"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"result"},"name":{"kind":"Name","value":"updateDiff"},"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":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"baselineId"}},{"kind":"Field","name":{"kind":"Name","value":"snapshotId"}}]}}]}}]} as unknown as DocumentNode; -export const WebdriverSessionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"webdriverSession"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"result"},"name":{"kind":"Name","value":"webdriverSession"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sessionId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"blob"}},{"kind":"Field","name":{"kind":"Name","value":"operatingSystem"}},{"kind":"Field","name":{"kind":"Name","value":"operatingSystemVersion"}},{"kind":"Field","name":{"kind":"Name","value":"browser"}},{"kind":"Field","name":{"kind":"Name","value":"browserVersion"}}]}}]}}]} as unknown as DocumentNode; -export const WebdriverSessionInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"webdriverSessionInfo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"WebdriverSessionInfoIn"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"result"},"name":{"kind":"Name","value":"webdriverSessionInfo"},"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":"blob"}},{"kind":"Field","name":{"kind":"Name","value":"operatingSystem"}},{"kind":"Field","name":{"kind":"Name","value":"operatingSystemVersion"}},{"kind":"Field","name":{"kind":"Name","value":"browser"}},{"kind":"Field","name":{"kind":"Name","value":"browserVersion"}},{"kind":"Field","name":{"kind":"Name","value":"deviceName"}}]}}]}}]} as unknown as DocumentNode; +export const WebdriverSessionInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"webdriverSessionInfo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"WebdriverSessionInfoIn"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"result"},"name":{"kind":"Name","value":"webdriverSessionInfo"},"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":"blob"}},{"kind":"Field","name":{"kind":"Name","value":"operatingSystem"}},{"kind":"Field","name":{"kind":"Name","value":"operatingSystemVersion"}},{"kind":"Field","name":{"kind":"Name","value":"browser"}},{"kind":"Field","name":{"kind":"Name","value":"browserVersion"}},{"kind":"Field","name":{"kind":"Name","value":"deviceName"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file From 7cbf0869cf1bedcf3a72556c7b8407610629c6aa Mon Sep 17 00:00:00 2001 From: Benjamin Karran Date: Tue, 28 May 2024 12:09:21 +0200 Subject: [PATCH 2/4] docs(changeset): Remove deprecated API calls --- visual-js/.changeset/tiny-plums-yawn.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 visual-js/.changeset/tiny-plums-yawn.md diff --git a/visual-js/.changeset/tiny-plums-yawn.md b/visual-js/.changeset/tiny-plums-yawn.md new file mode 100644 index 00000000..18d56b9a --- /dev/null +++ b/visual-js/.changeset/tiny-plums-yawn.md @@ -0,0 +1,9 @@ +--- +"@saucelabs/visual": minor +"@saucelabs/cypress-visual-plugin": patch +"@saucelabs/nightwatch-sauce-visual-service": patch +"@saucelabs/visual-storybook": patch +"@saucelabs/wdio-sauce-visual-service": patch +--- + +Remove deprecated API calls From 20e5441154d82875645f7dd770a8718e26c6e060 Mon Sep 17 00:00:00 2001 From: Benjamin Karran Date: Tue, 28 May 2024 12:25:19 +0200 Subject: [PATCH 3/4] update java --- visual-java/pom.xml | 5 +++ visual-java/src/main/graphql/README.md | 4 +++ .../src/main/graphql/visual/schema.graphqls | 31 ++++++++++++++++--- .../graphql/visual/webdriverSession.graphql | 9 ------ 4 files changed, 36 insertions(+), 13 deletions(-) delete mode 100644 visual-java/src/main/graphql/visual/webdriverSession.graphql diff --git a/visual-java/pom.xml b/visual-java/pom.xml index 67920597..e7e1d95f 100644 --- a/visual-java/pom.xml +++ b/visual-java/pom.xml @@ -194,6 +194,11 @@ java.lang.String graphql.scalars.ExtendedScalars.Object + + WebdriverElementID + java.lang.String + graphql.scalars.ExtendedScalars.Object + diff --git a/visual-java/src/main/graphql/README.md b/visual-java/src/main/graphql/README.md index ce06d53a..4b3071cc 100644 --- a/visual-java/src/main/graphql/README.md +++ b/visual-java/src/main/graphql/README.md @@ -3,7 +3,11 @@ - the schema `./visual/schema.grapqhls` is copied from `backend/src/generated/schema.sql` and appended with the following: +```sh +cp ../../iris/backend/src/generated/schema.graphql src/main/graphql/visual/schema.graphqls ``` + +```graphql schema { mutation: Mutation query: Query diff --git a/visual-java/src/main/graphql/visual/schema.graphqls b/visual-java/src/main/graphql/visual/schema.graphqls index 8a3fa3d2..df9cb142 100644 --- a/visual-java/src/main/graphql/visual/schema.graphqls +++ b/visual-java/src/main/graphql/visual/schema.graphqls @@ -66,6 +66,7 @@ type Baseline implements Node { id: UUID! imageUrl: String! isLatest: Boolean! + metadata: JSON name: String! """ @@ -497,6 +498,9 @@ input CreateSnapshotFromWebDriverIn { buildUuid: UUID captureDom: Boolean + """The selenium ID of an element we should clip the screen to.""" + clipElement: WebdriverElementID + """ A querySelector compatible selector of an element that we should crop the screenshot to. """ @@ -509,6 +513,7 @@ input CreateSnapshotFromWebDriverIn { Limitation: Currently, this feature is supported only on desktop browsers. """ fullPageConfig: FullPageConfigIn + ignoreElements: [ElementIn!] ignoreRegions: [RegionIn!] """This will be mandatory in the future.""" @@ -779,6 +784,14 @@ enum DiffsOrderBy { STATUS_IS_EQUAL_DESC } +input ElementIn { + diffingOptions: DiffingOptionsIn + + """The server-assigned ID of an element from webdriver.""" + id: WebdriverElementID! + name: String +} + input FinishBuildIn { """@deprecated Use `uuid`. This field will be removed in a future update.""" id: ID @@ -786,7 +799,7 @@ input FinishBuildIn { } input FullPageConfigIn { - """Adjust address bar padding on iOS and Android for viewport cutout.""" + """@deprecated this field will be removed soon.""" addressBarShadowPadding: Float """ @@ -801,6 +814,11 @@ input FullPageConfigIn { """Hide elements on the page after first scroll by css selectors.""" hideAfterFirstScroll: [String] + """ + Hide elements on the page after first scroll using their server-assigned ID from webdriver. + """ + hideElementsAfterFirstScroll: [WebdriverElementID!] + """Hide all scrollbars in the app.""" hideScrollBars: Boolean @@ -810,7 +828,7 @@ input FullPageConfigIn { """ scrollLimit: Int - """Adjust toolbar padding on iOS and Android for viewport cutout.""" + """@deprecated this field will be removed soon.""" toolBarShadowPadding: Int } @@ -1278,8 +1296,6 @@ type Query implements Node { """The method to use when ordering `Snapshot`.""" orderBy: [SnapshotsOrderBy!] = [PRIMARY_KEY_ASC] ): SnapshotsConnection - webdriverSession(sessionId: ID!): WebdriverSession @deprecated(reason: "Use webdriverSessionInfo. This will be removed by 2024-02-11.") - webdriverSessionFromArchive(jobId: ID!, sessionId: ID!): WebdriverSession @deprecated(reason: "Use webdriverSessionInfo. This will be removed by 2024-02-11.") webdriverSessionInfo(input: WebdriverSessionInfoIn!): WebdriverSession } @@ -1395,6 +1411,9 @@ type Snapshot implements Node { By convention, the following errors exist: - `{"code": "TRUNCATED"}`: The image file is corrupt and was probably truncated. + - `{"domCode": "DOM_TOO_LARGE"}`: [WARNING] The uploaded DOM is too large. + - `{"domCode": "DOM_MISSING"}`: [WARNING] A DOM snapshot was requested, but could not be captured. + - `{"domCode": "DOM_INVALID"}`: [WARNING] The DOM snapshot has an invalid structure. Other error types may exist and the frontend should display a generic error message together with the JSON contents of `error`. @@ -1414,6 +1433,7 @@ type Snapshot implements Node { URL that is used by the frontend to link to the job, task or process that has generated this snapshot. For exemple, a link to a Sauce Session. """ jobUrl: String + metadata: JSON name: String! """ @@ -1480,6 +1500,7 @@ input SnapshotIn { diffingOptions: DiffingOptionsIn ignoreRegions: [RegionIn!] jobUrl: String + metadata: JSON name: String! operatingSystem: OperatingSystem operatingSystemVersion: String @@ -1622,6 +1643,8 @@ type User { username: String } +scalar WebdriverElementID + type WebdriverSession { applicationSummary: ApplicationSummary diff --git a/visual-java/src/main/graphql/visual/webdriverSession.graphql b/visual-java/src/main/graphql/visual/webdriverSession.graphql deleted file mode 100644 index 42c7fe13..00000000 --- a/visual-java/src/main/graphql/visual/webdriverSession.graphql +++ /dev/null @@ -1,9 +0,0 @@ -query webdriverSession($input: ID!) { - result: webdriverSession(sessionId: $input) { - blob - operatingSystem - operatingSystemVersion - browser - browserVersion - } -} From 22eccb5d2f7efb08e79fd35285e6d61a55a8c831 Mon Sep 17 00:00:00 2001 From: Benjamin Karran Date: Tue, 28 May 2024 13:06:48 +0200 Subject: [PATCH 4/4] review --- visual-js/.changeset/tiny-plums-yawn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visual-js/.changeset/tiny-plums-yawn.md b/visual-js/.changeset/tiny-plums-yawn.md index 18d56b9a..9d1e83a3 100644 --- a/visual-js/.changeset/tiny-plums-yawn.md +++ b/visual-js/.changeset/tiny-plums-yawn.md @@ -6,4 +6,4 @@ "@saucelabs/wdio-sauce-visual-service": patch --- -Remove deprecated API calls +Remove deprecated API calls webwebdriverSession and webdriverSessionFromArchive \ No newline at end of file