Skip to content

Commit e7b41b1

Browse files
authored
Merge pull request #189 from argos-ci/greg/arg-253-subset-builds-ignore-removed-snapshots
feat(subset): add subset builds doc
2 parents 005523d + fd7c45a commit e7b41b1

2 files changed

Lines changed: 138 additions & 2 deletions

File tree

docs/learn/fundamentals/baseline-build.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ Argos selects the baseline build by finding the most recent **candidate build**
2525

2626
1. Has the same build name as the triggered build
2727
2. All framework tests passed
28-
3. Be auto-approved, manually approved or orphan
29-
4. Its commit is an ancestor of the merge base between the triggered build's commit and the baseline branch
28+
3. Build is not marked as [_subset_](/subset-builds)
29+
4. Be auto-approved, manually approved or orphan
30+
5. Its commit is an ancestor of the merge base between the triggered build's commit and the baseline branch
3031

3132
## What is the baseline branch?
3233

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
slug: /subset-builds
3+
sidebar_label: Subset builds
4+
---
5+
6+
import { RunPkgCommand } from "@site/src/partials";
7+
8+
# Subset builds
9+
10+
Subset builds are designed for CI runs that **don't execute the full E2E test suite** on a branch. When a build is marked as subset, Argos **ignores removed screenshots** and only notifies you about **changed and added screenshots** from the tests you did run.
11+
12+
This is helpful for speeding up feature-branch validation while still getting reliable visual feedback from the relevant tests.
13+
14+
:::note
15+
16+
You still need to run your full test suite on your main branch to create and update **baseline builds**. Subset builds are not eligible as baselines. See [Baseline build](/baseline-build).
17+
18+
:::
19+
20+
## Diagram flow
21+
22+
```mermaid
23+
flowchart TB
24+
%% Subset builds vertical layout
25+
26+
Start["CI run starts"]
27+
28+
subgraph Main["Main branch"]
29+
direction TB
30+
M1["Run full E2E suite"]
31+
M2["Upload screenshots"]
32+
M3["Baseline build<br/>added · changed · removed"]
33+
M1 --> M2 --> M3
34+
end
35+
36+
subgraph Feature["Feature branch"]
37+
direction TB
38+
F0["ARGOS_SUBSET=true<br/>or --subset"]
39+
F1["Run partial suite"]
40+
F2["Upload screenshots"]
41+
F3["Subset build notifications<br/>only changed and added screenshots"]
42+
F0 --> F1 --> F2 --> F3
43+
end
44+
45+
Start --> Main
46+
Start --> Feature
47+
48+
M3 -. "Compare against baseline" .-> F3
49+
```
50+
51+
## Enable subset builds
52+
53+
You can enable subset builds in any Argos SDK or the CLI.
54+
55+
### Environment variable
56+
57+
Set the environment variable `ARGOS_SUBSET` to `"true"` in your CI configuration.
58+
59+
```yml title=".github/workflows/ci.yml"
60+
steps:
61+
- name: Run tests
62+
run: npm test
63+
env:
64+
ARGOS_SUBSET: "true"
65+
```
66+
67+
### CLI
68+
69+
Use the `--subset` flag with the CLI.
70+
71+
<RunPkgCommand command="argos upload --subset ./screenshots" />
72+
73+
### SDK option
74+
75+
Most SDKs expose a `subset` option on the upload configuration.
76+
77+
```js title="upload.js"
78+
import { upload } from "@argos-ci/core";
79+
80+
await upload({
81+
root: "./screenshots",
82+
subset: true,
83+
});
84+
```
85+
86+
## Examples
87+
88+
### Node.js
89+
90+
```js title="scripts/argos-upload.js"
91+
import { upload } from "@argos-ci/core";
92+
93+
await upload({
94+
root: "./screenshots",
95+
subset: true,
96+
});
97+
```
98+
99+
### Playwright
100+
101+
For Playwright, simply set `ARGOS_SUBSET=true` in your CI job. The reporter will mark the build as a subset build.
102+
103+
```yml title=".github/workflows/ci.yml"
104+
steps:
105+
- uses: actions/checkout@v4
106+
- uses: actions/setup-node@v4
107+
- run: npm ci
108+
- name: Run Playwright tests
109+
env:
110+
ARGOS_SUBSET: "true"
111+
run: npx playwright test
112+
```
113+
114+
### Cypress
115+
116+
For Cypress, set `ARGOS_SUBSET=true` in your CI job that runs Cypress and uploads screenshots.
117+
118+
```yml title=".github/workflows/ci.yml"
119+
steps:
120+
- uses: actions/checkout@v4
121+
- uses: actions/setup-node@v4
122+
- run: npm ci
123+
- name: Run Cypress tests
124+
env:
125+
ARGOS_SUBSET: "true"
126+
run: npx cypress run
127+
```
128+
129+
## Troubleshooting / FAQ
130+
131+
**Why are removed screenshots ignored?**
132+
Subset builds only include a portion of your test suite, so missing screenshots may simply be from skipped tests, not actual deletions. Ignoring removals avoids false positives.
133+
134+
**Why can’t a subset build be a baseline?**
135+
Baselines must represent the full test suite. Subset builds are incomplete by design and would cause missing screenshots in comparisons.

0 commit comments

Comments
 (0)