Skip to content

Commit 7317c25

Browse files
author
Kerem Beygo
committed
CR remarks
1 parent 74085d4 commit 7317c25

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

docs/visual-testing/workflows/api-lifecycle.md

+48-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To start, you need to create a build. This initializes the process and prepares
2424

2525
```graphql
2626
mutation {
27-
createBuild(input: { name: "Your Build Name" }) {
27+
createBuild(input: { name: "Your Build Name", branch: "Branch name", project: "Project name" }) {
2828
id
2929
name
3030
status
@@ -33,6 +33,9 @@ mutation {
3333
}
3434
```
3535

36+
- `branch`: Branch name to associate the build with.
37+
- `project`: Label/project to associate the build with.
38+
3639
**Expected Response:**
3740

3841
```json
@@ -64,6 +67,7 @@ mutation {
6467
createSnapshotUpload(input: {buildId: "build-id-here"}) {
6568
id
6669
uploadUrl
70+
domUploadUrl
6771
}
6872
}
6973
```
@@ -77,45 +81,79 @@ mutation {
7781
"data": {
7882
"createSnapshotUpload": {
7983
"id": "upload-id-here",
80-
"uploadUrl": "upload-url-here"
84+
"uploadUrl": "image-upload-url-here",
85+
"domUploadUrl": "dom-upload-url-here"
8186
}
8287
}
8388
}
8489
```
8590

8691
- `id`: Upload ID to use in the subsequent steps.
8792
- `uploadUrl`: The URL to upload the image in the next step.
93+
- `domUploadUrl`: The URL to upload the DOM to (if available and desired). Explained in optional step below.
8894

8995
Next, send a `PUT` request to `uploadUrl` with image file in the body of the request. Only **PNG** files are supported.
9096

91-
**cURL Representation:**
97+
**cURL:**
9298

9399
```sh
94100
curl --request PUT \
95101
--url 'upload-url-here' \
102+
--header 'Content-MD5: base64-encoded-md5-hash' \
96103
--header 'Content-Type: image/png' \
97104
--data '@my-screenshot.png'
98105
```
99106

107+
- `Content-MD5` header: Base64 encoded MD5 hash of the file (`my-screenshot.png`).
108+
- `Content-Type` header: Must be set to `image/png`. Not other extensions are supported.
109+
110+
Optional: Upload DOM
111+
112+
If desired (and available), DOM can be also uploaded to `domUploadUrl` obtained from `createSnapshotUpload` mutation.
113+
114+
**cURL:**
115+
116+
```sh
117+
curl --request PUT \
118+
--url 'dom-upload-url-here' \
119+
--header 'Content-MD5: base64-encoded-md5-hash' \
120+
--header 'Content-Type: text/html' \
121+
--data '@my-dom.html'
122+
```
123+
124+
- `Content-MD5` header: Base64 encoded MD5 hash of the file (`my-dom.html`).
125+
- `Content-Type` header: Must be set to `text/html`. Not other extensions are supported.
126+
100127
### 3. Create Snapshot
101128

102-
After uploading your image, add your snapshot and its metadata to your build.
129+
After uploading your image, add your snapshot along with its metadata to your build.
103130

104131
**GraphQL Mutation:**
105132

106133
```graphql
107134
mutation {
108135
createSnapshot(
109-
input: {buildUuid: "build-id-here", uploadId: "upload-id-here", name: "Your snapshot name"}
136+
input: {
137+
buildUuid: "build-id-here",
138+
uploadId: "upload-id-here",
139+
name: "Your snapshot name",
140+
operatingSystem: OS,
141+
operatingSystemVersion: "os-version",
142+
browser: BROWSER,
143+
browserVersion: "browser-version"
144+
}
110145
) {
111146
id
112147
uploadId
113148
}
114149
}
115150
```
116-
117-
- `uploadId`: Upload ID acquired with `createSnapshotUpload` in the previous step.
118151
- `buildUuid`: Build ID that was used in previous steps.
152+
- `uploadId`: Upload ID acquired with `createSnapshotUpload` in the previous step.
153+
- `operatingSystem`: The operating system used to take the snapshot. Strongly advised to be filled in. Available options: `ANDROID`, `IOS`, `LINUX`, `MACOS`, `WINDOWS`.
154+
- `operatingSystemVersion`: The operating system version. e.g. "14.5" for `MACOS` or "11" for `WINDOWS`.
155+
- `browser`: The browser used to take the snapshot. Strongly advised to be filled in (if available). Available options: `CHROME`, `EDGE`, `FIREFOX`, `PLAYWRIGHT_WEBKIT`, `SAFARI`.
156+
- `browserVersion`: The browser version. e.g. "120.0.6099.318", "128.0.2".
119157

120158
**Expected Response:**
121159

@@ -134,7 +172,9 @@ mutation {
134172

135173
### 4. Finish Build
136174

137-
Finally, finish the build to mark it as complete.
175+
Finally, finish the build to mark it as complete. Keep in mind that this is a necessary step and the build cannot be reused after it's finished.
176+
177+
It's also worth noting that unfinished builds will be automatically closed and set to `ERRORED` state after a certain period of time (default: 3 hours).
138178

139179
**GraphQL Mutation:**
140180

0 commit comments

Comments
 (0)