proofsheet 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +26 -75
- data/Rakefile +9 -0
- data/USAGE.md +408 -0
- data/examples/01_simple.yml +9 -0
- data/examples/02_targets_and_clipping.yml +16 -0
- data/examples/03_authentication.yml +29 -0
- data/examples/04_fetching_images.yml +19 -0
- data/examples/05_compositions.yml +48 -0
- data/examples/assets/logo.svg +12 -0
- data/examples/assets/logo480.png +0 -0
- data/examples/assets/wordmark_960_104.png +0 -0
- data/examples/output/avo_dashboard.png +0 -0
- data/examples/output/cat_badge.png +0 -0
- data/examples/output/cat_placeholder.png +0 -0
- data/examples/output/contact_sheet_lead.png +0 -0
- data/examples/output/fascination_logo.png +0 -0
- data/examples/output/homepage.png +0 -0
- data/examples/output/sample_page.png +0 -0
- data/examples/output/showcase.png +0 -0
- data/examples/output/web_page.png +0 -0
- data/lib/proofsheet/browser.rb +11 -0
- data/lib/proofsheet/capturer.rb +38 -7
- data/lib/proofsheet/cli.rb +28 -7
- data/lib/proofsheet/composer.rb +132 -0
- data/lib/proofsheet/composition_config.rb +73 -0
- data/lib/proofsheet/cropper.rb +34 -0
- data/lib/proofsheet/download.rb +27 -0
- data/lib/proofsheet/image_config.rb +43 -0
- data/lib/proofsheet/manifest.rb +34 -0
- data/lib/proofsheet/rounded_corners.rb +47 -0
- data/lib/proofsheet/version.rb +1 -1
- data/lib/proofsheet.rb +6 -0
- metadata +26 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 234b0c63a2f6605f90b645c9f1b0f0edea3d57f14c9b4a9957ccd3ac26d20cf1
|
|
4
|
+
data.tar.gz: 7fc0d9240630bdfe9126eca40b4ba64113bdb69ed3f0bb1734dda1fb7c01dccb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae87dcc521208176985d9d990ab7061d19d30d0df7ac22bb92d01c6cc186b2f5977ac38aa4486daa6e4fea812522244a8954136e31559cf307fb982f1fa0c735
|
|
7
|
+
data.tar.gz: 430df63a9d720cde283a68e970e8c6c58f84f8851a37c907ce5679da14d1562239c2aba8b51b7fd9be50cbe86941408df937a423630cb35261b23e612fcb837e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.3.0] - 2026-11-30
|
|
4
|
+
|
|
5
|
+
- Add `images` for logos, watermarks, and other artwork Proofsheet did not capture, read from a local path, downloaded from a URL, or downloaded from an `<img>` selected on any webpage
|
|
6
|
+
- Draw them in compositions with `image:` layers, which take the same crop, resize, radius, rotation, and shadow options as `shot:` layers
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - 2026-09-19
|
|
9
|
+
|
|
10
|
+
- Add the `compose` command for arranging captured screenshots on solid, transparent, gradient, or image backgrounds
|
|
11
|
+
- Add per-layer cropping, proportional resizing, rounded corners, rotation, and shadows
|
|
12
|
+
|
|
3
13
|
## [0.1.0] - 2026-09-09
|
|
4
14
|
|
|
5
15
|
- Initial release
|
data/README.md
CHANGED
|
@@ -1,114 +1,65 @@
|
|
|
1
1
|
# Proofsheet
|
|
2
2
|
|
|
3
|
-
Proofsheet captures repeatable screenshots from web applications
|
|
3
|
+
Proofsheet captures repeatable screenshots from web applications and assembles them into polished image compositions. A YAML manifest describes what to capture; the `proofsheet` CLI runs it in headless Chrome and writes PNG files.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
Install the gem:
|
|
8
|
-
|
|
9
7
|
```sh
|
|
10
8
|
gem install proofsheet
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
Proofsheet requires
|
|
11
|
+
Proofsheet requires Ruby 3.2 or newer, Chrome, and libvips.
|
|
14
12
|
|
|
15
|
-
##
|
|
13
|
+
## Quick start
|
|
16
14
|
|
|
17
|
-
Create `proofsheet.yml` in
|
|
15
|
+
Create `proofsheet.yml` in your project:
|
|
18
16
|
|
|
19
17
|
```yaml
|
|
20
18
|
host: "https://example.com"
|
|
21
19
|
|
|
22
|
-
expect:
|
|
23
|
-
username: "demo@example.com"
|
|
24
|
-
|
|
25
|
-
credentials:
|
|
26
|
-
username: "env:PROOFSHEET_USERNAME"
|
|
27
|
-
password: "env:PROOFSHEET_PASSWORD"
|
|
28
|
-
|
|
29
|
-
login:
|
|
30
|
-
path: "/sign-in"
|
|
31
|
-
username_field: "email"
|
|
32
|
-
password_field: "password"
|
|
33
|
-
submit: "Sign in"
|
|
34
|
-
expect:
|
|
35
|
-
selector: "header"
|
|
36
|
-
text: "demo@example.com"
|
|
37
|
-
|
|
38
|
-
targets:
|
|
39
|
-
account: 42
|
|
40
|
-
|
|
41
20
|
defaults:
|
|
42
21
|
viewport: [1440, 900]
|
|
43
22
|
output_dir: "docs/screenshots"
|
|
44
23
|
|
|
45
24
|
shots:
|
|
46
|
-
|
|
47
|
-
path: "/
|
|
48
|
-
wait_for: "[data-testid='dashboard']"
|
|
49
|
-
expect:
|
|
50
|
-
selector: ".account-name"
|
|
51
|
-
text: "Demo Account"
|
|
52
|
-
|
|
53
|
-
activity:
|
|
54
|
-
path: "/accounts/%{account}/activity"
|
|
55
|
-
wait_for: "[data-testid='activity-chart']"
|
|
56
|
-
click: "[data-range='7d']"
|
|
57
|
-
clip:
|
|
58
|
-
selector: "[data-testid='activity-chart']"
|
|
59
|
-
padding: 5
|
|
60
|
-
|
|
61
|
-
toolbar:
|
|
62
|
-
path: "/accounts/%{account}"
|
|
63
|
-
clip:
|
|
64
|
-
selector: ".toolbar"
|
|
65
|
-
full_width: true
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
The `login` section is optional; `credentials` is required when `login` is present. The `expect`, `targets`, `wait_for`, `click`, and `clip` sections are optional. The default viewport is `1440×900`, and the default output directory is `screenshots`.
|
|
69
|
-
|
|
70
|
-
Credential sources must be environment variables such as `env:PROOFSHEET_USERNAME` or 1Password secret references such as `op://Vault/Item/username`. Add `op_account` under `credentials` when 1Password needs an explicit account.
|
|
71
|
-
|
|
72
|
-
An `expect.username` value stops capture before Chrome starts if the loaded username is not the intended screenshot account. A login or shot-level `expect` stops capture when the expected text is absent from the selected element.
|
|
73
|
-
|
|
74
|
-
For pages whose final URL is only discoverable in the browser, `path_script` may contain JavaScript that returns a path. Set `resolved_wait_for` to wait for the destination content:
|
|
75
|
-
|
|
76
|
-
```yaml
|
|
77
|
-
shots:
|
|
78
|
-
latest-report:
|
|
79
|
-
path: "/reports"
|
|
80
|
-
wait_for: "[data-latest-report]"
|
|
81
|
-
path_script: "document.querySelector('[data-latest-report]').getAttribute('href')"
|
|
82
|
-
resolved_wait_for: "iframe[title='Report']"
|
|
25
|
+
homepage:
|
|
26
|
+
path: "/"
|
|
83
27
|
```
|
|
84
28
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Capture every shot:
|
|
29
|
+
Then capture it:
|
|
88
30
|
|
|
89
31
|
```sh
|
|
90
32
|
proofsheet capture
|
|
91
33
|
```
|
|
92
34
|
|
|
93
|
-
|
|
35
|
+
The main commands are:
|
|
94
36
|
|
|
95
37
|
```sh
|
|
96
|
-
proofsheet capture
|
|
97
|
-
proofsheet
|
|
98
|
-
proofsheet
|
|
38
|
+
proofsheet capture # Capture configured shots and fetched images
|
|
39
|
+
proofsheet compose # Build configured compositions
|
|
40
|
+
proofsheet list # List configured shots without opening Chrome
|
|
99
41
|
```
|
|
100
42
|
|
|
101
|
-
|
|
43
|
+
## Features
|
|
102
44
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
45
|
+
- Repeatable full-viewport and element-cropped screenshots driven by YAML
|
|
46
|
+
- Readiness selectors, scripted clicks, content assertions, target substitution, and browser-resolved paths
|
|
47
|
+
- Authenticated captures using environment variables or 1Password references, with identity safeguards
|
|
48
|
+
- Local image assets, direct URL downloads, and browser-selected `<img>` downloads using `currentSrc`
|
|
49
|
+
- Automatic conversion of downloaded images to PNG, including alpha transparency
|
|
50
|
+
- Compositions with solid, transparent, gradient, or image backgrounds
|
|
51
|
+
- Layer cropping, proportional resizing, rounded corners, rotation, positioning, and shadows
|
|
52
|
+
- Selective capture and composition from the command line
|
|
106
53
|
|
|
107
|
-
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
See [USAGE.md](USAGE.md) for the complete guide, runnable manifests, generated example images, and configuration reference.
|
|
108
57
|
|
|
109
58
|
## Development
|
|
110
59
|
|
|
111
|
-
Run `bin/setup`, then `bundle exec rake` to run the specs and linter.
|
|
60
|
+
Run `bin/setup`, then `bundle exec rake` to run the specs and linter. Regenerate the usage guide and its real example images with `bundle exec rake usage`.
|
|
61
|
+
|
|
62
|
+
To install the gem locally, run `bundle exec rake install`.
|
|
112
63
|
|
|
113
64
|
## License
|
|
114
65
|
|
data/Rakefile
CHANGED
|
@@ -10,3 +10,12 @@ require "rubocop/rake_task"
|
|
|
10
10
|
RuboCop::RakeTask.new
|
|
11
11
|
|
|
12
12
|
task default: %i[spec rubocop]
|
|
13
|
+
|
|
14
|
+
desc "Update USAGE.md with examples and generated images"
|
|
15
|
+
task :usage do
|
|
16
|
+
require "proofsheet"
|
|
17
|
+
require_relative "lib/proofsheet/usage_updater"
|
|
18
|
+
Proofsheet::UsageUpdater.new.update!
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
task docs: :usage
|
data/USAGE.md
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# Proofsheet Usage Guide
|
|
2
|
+
|
|
3
|
+
Proofsheet automates capturing crisp, repeatable screenshots from web applications and assembling them into polished graphic compositions.
|
|
4
|
+
|
|
5
|
+
This guide walks through Proofsheet's features progressively, from a minimal single-shot capture to multi-layer marketing compositions with remote and local images. Every example is backed by a standalone YAML file in the `examples/` directory and can be updated using `bundle exec rake usage`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Command-Line Interface (CLI)
|
|
10
|
+
|
|
11
|
+
Proofsheet provides a single CLI binary with three primary commands:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
proofsheet capture [SHOT ...] [--config PATH] [--host HOST]
|
|
15
|
+
proofsheet compose [COMPOSITION ...] [--config PATH]
|
|
16
|
+
proofsheet list [--config PATH]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **`capture`**: Launches headless Chrome, logs in (if configured), navigates to shot URLs, clips elements, and downloads remote images. If no shot or image names are specified, all configured shots and remote images are captured.
|
|
20
|
+
- **`compose`**: Combines captured shots and assets onto defined canvases using libvips. If no composition names are provided, all configured compositions are built.
|
|
21
|
+
- **`list`**: Prints configured shot names and paths without launching Chrome.
|
|
22
|
+
- **`--config PATH`** (`-c PATH`): Specifies the manifest configuration file (defaults to `proofsheet.yml`).
|
|
23
|
+
- **`--host HOST`**: Overrides the base URL specified in the manifest.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. Simple Screenshot Capture
|
|
28
|
+
|
|
29
|
+
At its simplest, a Proofsheet manifest declares a `host` and a list of `shots`. Each shot must provide a `path` relative to `host`.
|
|
30
|
+
|
|
31
|
+
<!-- example: examples/01_simple.yml image: examples/output/homepage.png alt: "Example Domain Homepage" -->
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
host: "https://example.com"
|
|
35
|
+
|
|
36
|
+
defaults:
|
|
37
|
+
viewport: [1200, 800]
|
|
38
|
+
output_dir: "examples/output"
|
|
39
|
+
|
|
40
|
+
shots:
|
|
41
|
+
homepage:
|
|
42
|
+
path: "/"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
<!-- end-example -->
|
|
48
|
+
|
|
49
|
+
To run this capture:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
proofsheet capture --config examples/01_simple.yml
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This starts headless Chrome at the default viewport (`1200×800` as overridden under `defaults`), navigates to `https://example.com/`, waits for the page and web fonts to settle, and saves the full viewport to `examples/output/homepage.png`.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 2. Dynamic Targets and Element Clipping
|
|
60
|
+
|
|
61
|
+
When capturing documentation or marketing assets, you frequently want to focus on a specific component or UI element rather than the entire browser viewport. Proofsheet allows clipping shots directly to CSS selectors with optional padding.
|
|
62
|
+
|
|
63
|
+
Additionally, URL paths can include dynamic variable placeholders using `%{variable_name}`, which Proofsheet interpolates from the `targets` block.
|
|
64
|
+
|
|
65
|
+
<!-- example: examples/02_targets_and_clipping.yml image: examples/output/contact_sheet_lead.png alt: "Contact Print Wikipedia Element" -->
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
host: "https://en.wikipedia.org"
|
|
69
|
+
|
|
70
|
+
targets:
|
|
71
|
+
article: "Contact_print"
|
|
72
|
+
|
|
73
|
+
defaults:
|
|
74
|
+
viewport: [1440, 900]
|
|
75
|
+
output_dir: "examples/output"
|
|
76
|
+
|
|
77
|
+
shots:
|
|
78
|
+
contact_sheet_lead:
|
|
79
|
+
path: "/wiki/%{article}"
|
|
80
|
+
wait_for: "#firstHeading"
|
|
81
|
+
clip:
|
|
82
|
+
selector: "figure"
|
|
83
|
+
padding: 8
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
<!-- end-example -->
|
|
89
|
+
|
|
90
|
+
Key options used here:
|
|
91
|
+
- **`targets`**: Defines key-value pairs interpolated into `path` templates (e.g. `/wiki/%{article}` becomes `/wiki/Contact_print`).
|
|
92
|
+
- **`wait_for`**: Halts capture until the selector (`#firstHeading`) is rendered in the DOM.
|
|
93
|
+
- **`clip`**:
|
|
94
|
+
- `selector`: Computes the element's bounding box and crops the capture around it.
|
|
95
|
+
- `padding`: Adds spacing (in pixels) around all four sides of the element.
|
|
96
|
+
- `full_width`: (Optional, `true` or `false`) When `true`, expands the clip horizontally to fill the full viewport width while cropping vertically.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 3. Authenticated Sessions & Safety Expectations
|
|
101
|
+
|
|
102
|
+
Many web applications require authentication before screenshots can be taken. Proofsheet automates the login sequence through headless Chrome and protects against taking screenshots of the wrong account or broken states.
|
|
103
|
+
|
|
104
|
+
The example below runs against an online Ruby on Rails demo ([Avo](https://main.avodemo.com)):
|
|
105
|
+
|
|
106
|
+
<!-- example: examples/03_authentication.yml image: examples/output/avo_dashboard.png alt: "Authenticated Admin Dashboard" -->
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
host: "https://main.avodemo.com"
|
|
110
|
+
|
|
111
|
+
expect:
|
|
112
|
+
username: "avo@cado.com"
|
|
113
|
+
|
|
114
|
+
credentials:
|
|
115
|
+
username: "env:AVO_DEMO_USERNAME"
|
|
116
|
+
password: "env:AVO_DEMO_PASSWORD"
|
|
117
|
+
|
|
118
|
+
login:
|
|
119
|
+
path: "/users/sign_in"
|
|
120
|
+
username_field: "user_email"
|
|
121
|
+
password_field: "user_password"
|
|
122
|
+
submit: "Sign in"
|
|
123
|
+
expect:
|
|
124
|
+
selector: "body"
|
|
125
|
+
text: "Dashboards"
|
|
126
|
+
|
|
127
|
+
defaults:
|
|
128
|
+
viewport: [1280, 800]
|
|
129
|
+
output_dir: "examples/output"
|
|
130
|
+
|
|
131
|
+
shots:
|
|
132
|
+
avo_dashboard:
|
|
133
|
+
path: "/avo/dashboards/dashy"
|
|
134
|
+
wait_for: "main"
|
|
135
|
+
expect:
|
|
136
|
+
selector: "body"
|
|
137
|
+
text: "Dashy"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+

|
|
141
|
+
|
|
142
|
+
<!-- end-example -->
|
|
143
|
+
|
|
144
|
+
Security and verification mechanisms:
|
|
145
|
+
- **`credentials`**: Passwords and usernames are never written into the manifest. Instead, they reference environment variables (`env:VARIABLE_NAME`) or 1Password secrets (`op://vault/item/field`).
|
|
146
|
+
- **`expect.username`**: Verifies that the resolved username matches what the manifest author intended before Chrome ever boots.
|
|
147
|
+
- **`login`**: Instructs Proofsheet how to navigate to the sign-in page, fill in the credentials, and submit the form.
|
|
148
|
+
- **`expect`**: Assertions can be placed on the login form or on individual shots. If the specified `selector` does not contain the expected `text`, Proofsheet immediately aborts capture with an error instead of saving an invalid screenshot.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 4. Fetching External Images
|
|
153
|
+
|
|
154
|
+
Compositions often require assets that Proofsheet did not directly photograph, such as partner marks, avatars, product photos, or brand logos. Proofsheet supports an `images:` section with three distinct sources:
|
|
155
|
+
|
|
156
|
+
1. **`url`**: Downloads an image directly over HTTP or HTTPS without starting Chrome (e.g., placeholder images or CDNs).
|
|
157
|
+
2. **`page` & `selector`**: Boots headless Chrome, visits `page`, locates the matching `<img>` element, and fetches the browser-resolved `currentSrc` (useful when responsive `srcset` or dynamic JavaScript determines the actual image URL).
|
|
158
|
+
3. **`path`**: Points to a local file on disk, resolved relative to where `proofsheet` is executed. Local path images do not need to be captured.
|
|
159
|
+
|
|
160
|
+
<!-- example: examples/04_fetching_images.yml images: examples/output/cat_placeholder.png, examples/output/fascination_logo.png -->
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
host: "https://example.com"
|
|
164
|
+
|
|
165
|
+
defaults:
|
|
166
|
+
output_dir: "examples/output"
|
|
167
|
+
|
|
168
|
+
shots:
|
|
169
|
+
sample_page:
|
|
170
|
+
path: "/"
|
|
171
|
+
|
|
172
|
+
images:
|
|
173
|
+
cat_placeholder:
|
|
174
|
+
url: "https://placecats.com/300/200"
|
|
175
|
+
|
|
176
|
+
fascination_logo:
|
|
177
|
+
page: "https://fascination.works"
|
|
178
|
+
selector: ".site-logo img"
|
|
179
|
+
|
|
180
|
+
studio_logo:
|
|
181
|
+
path: "examples/assets/logo480.png"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+

|
|
185
|
+
|
|
186
|
+

|
|
187
|
+
|
|
188
|
+
<!-- end-example -->
|
|
189
|
+
|
|
190
|
+
When running `proofsheet capture`, Proofsheet decodes the `url` and `page` images and writes them into the configured `output_dir` as real `<name>.png` files, retaining alpha transparency when the source has it.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 5. Multi-Layer Graphic Compositions
|
|
195
|
+
|
|
196
|
+
Once screenshots and images are captured, Proofsheet's composer arranges them onto a fresh canvas using high-performance libvips image processing.
|
|
197
|
+
|
|
198
|
+
Layers can be layered, resized proportionally, given rounded corners, rotated, and cast soft gaussian drop shadows.
|
|
199
|
+
|
|
200
|
+
<!-- example: examples/05_compositions.yml image: examples/output/showcase.png alt: "Multi-Layer Showcase Composition" -->
|
|
201
|
+
|
|
202
|
+
```yaml
|
|
203
|
+
host: "https://example.com"
|
|
204
|
+
|
|
205
|
+
defaults:
|
|
206
|
+
viewport: [800, 500]
|
|
207
|
+
output_dir: "examples/output"
|
|
208
|
+
|
|
209
|
+
shots:
|
|
210
|
+
web_page:
|
|
211
|
+
path: "/"
|
|
212
|
+
|
|
213
|
+
images:
|
|
214
|
+
cat_badge:
|
|
215
|
+
url: "https://placecats.com/300/300"
|
|
216
|
+
|
|
217
|
+
studio_logo:
|
|
218
|
+
path: "examples/assets/logo480.png"
|
|
219
|
+
|
|
220
|
+
compositions:
|
|
221
|
+
showcase:
|
|
222
|
+
canvas: [1200, 750]
|
|
223
|
+
background:
|
|
224
|
+
gradient: ["#1e293b", "#0f172a"]
|
|
225
|
+
angle: 135
|
|
226
|
+
layers:
|
|
227
|
+
- shot: web_page
|
|
228
|
+
x: 80
|
|
229
|
+
y: 100
|
|
230
|
+
width: 680
|
|
231
|
+
radius: 16
|
|
232
|
+
rotate: -2
|
|
233
|
+
shadow: true
|
|
234
|
+
|
|
235
|
+
- image: cat_badge
|
|
236
|
+
x: 740
|
|
237
|
+
y: 180
|
|
238
|
+
width: 360
|
|
239
|
+
radius: 24
|
|
240
|
+
rotate: 3
|
|
241
|
+
shadow:
|
|
242
|
+
x: 4
|
|
243
|
+
y: 20
|
|
244
|
+
blur: 28
|
|
245
|
+
color: "#00000066"
|
|
246
|
+
|
|
247
|
+
- image: studio_logo
|
|
248
|
+
x: 1040
|
|
249
|
+
y: 40
|
|
250
|
+
width: 100
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+

|
|
254
|
+
|
|
255
|
+
<!-- end-example -->
|
|
256
|
+
|
|
257
|
+
To build the composition:
|
|
258
|
+
|
|
259
|
+
```sh
|
|
260
|
+
# First ensure all source shots and remote images are captured:
|
|
261
|
+
proofsheet capture --config examples/05_compositions.yml
|
|
262
|
+
|
|
263
|
+
# Then generate the composition canvas:
|
|
264
|
+
proofsheet compose --config examples/05_compositions.yml
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Composition highlights:
|
|
268
|
+
- **`canvas`**: Defines `[width, height]` in pixels.
|
|
269
|
+
- **`background`**:
|
|
270
|
+
- Linear gradient: `gradient: ["#from", "#to"]` with an optional `angle:` in degrees.
|
|
271
|
+
- Solid color: `background: "#1e293b"` (supports 6-digit hex `#RRGGBB` or 8-digit hex `#RRGGBBAA` for alpha).
|
|
272
|
+
- Background image: `background: { image: "path/to/img.png" }` (automatically scaled and center-cropped to cover the canvas).
|
|
273
|
+
- **`layers`**:
|
|
274
|
+
- `shot:` references a captured shot name; `image:` references an image name.
|
|
275
|
+
- `x:` and `y:` coordinate positioning on the canvas.
|
|
276
|
+
- `width:` scales the layer proportionally to the specified pixel width.
|
|
277
|
+
- `radius:` rounds the layer's corners (clamped to half the smaller dimension).
|
|
278
|
+
- `rotate:` rotates the layer by degrees (with transparent background padding).
|
|
279
|
+
- `shadow: true`: applies a balanced drop shadow (`x: 0`, `y: 16`, `blur: 24`, `color: "#00000055"`). A custom mapping can override any of these parameters.
|
|
280
|
+
- `crop:` (optional) crops a sub-region `[x, y, width, height]` of the source screenshot before resizing.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Complete YAML Manifest Reference
|
|
285
|
+
|
|
286
|
+
The table below documents every configuration key available in Proofsheet manifests.
|
|
287
|
+
|
|
288
|
+
### Top-Level Configuration
|
|
289
|
+
|
|
290
|
+
| Key | Type | Required | Description |
|
|
291
|
+
|---|---|---|---|
|
|
292
|
+
| `host` | String | Yes (or via `--host`) | Base URL for the target application (e.g. `https://example.com`). |
|
|
293
|
+
| `shots` | Mapping | Yes | Definitions of screenshots to capture. Each entry maps a shot name to its settings. |
|
|
294
|
+
| `images` | Mapping | No | Definitions of external or local image assets. |
|
|
295
|
+
| `compositions` | Mapping | No | Definitions of multi-layer canvas compositions. |
|
|
296
|
+
| `defaults` | Mapping | No | Global capture settings (see [Defaults](#defaults)). |
|
|
297
|
+
| `targets` | Mapping | No | Key-value dictionary used for dynamic variable substitution (`%{key}`) in shot paths. |
|
|
298
|
+
| `credentials` | Mapping | If `login` is set | Credential resolution sources (see [Credentials](#credentials)). |
|
|
299
|
+
| `login` | Mapping | No | Automated authentication form configuration (see [Login](#login)). |
|
|
300
|
+
| `expect` | Mapping | No | Global safety checks (e.g. `username:` verification). |
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
### `defaults`
|
|
305
|
+
|
|
306
|
+
| Key | Type | Default | Description |
|
|
307
|
+
|---|---|---|---|
|
|
308
|
+
| `viewport` | `[width, height]` | `[1440, 900]` | Initial browser window and viewport dimensions in pixels. |
|
|
309
|
+
| `output_dir` | String | `"screenshots"` | Directory where captured screenshots, fetched images, and compositions are written. Resolved relative to working directory. |
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
### `credentials`
|
|
314
|
+
|
|
315
|
+
| Key | Type | Required | Description |
|
|
316
|
+
|---|---|---|---|
|
|
317
|
+
| `username` | String | Yes | Source for the username. Must be `env:VAR_NAME` or `op://vault/item/field`. |
|
|
318
|
+
| `password` | String | Yes | Source for the password. Must be `env:VAR_NAME` or `op://vault/item/field`. |
|
|
319
|
+
| `op_account` | String | No | Optional 1Password account shorthand or sign-in address passed to `op read --account`. |
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
### `login`
|
|
324
|
+
|
|
325
|
+
| Key | Type | Required | Description |
|
|
326
|
+
|---|---|---|---|
|
|
327
|
+
| `path` | String | Yes | Path to the sign-in page relative to `host` (e.g. `"/users/sign_in"`). |
|
|
328
|
+
| `username_field` | String | Yes | Field name, HTML ID, or label for the username input. |
|
|
329
|
+
| `password_field` | String | Yes | Field name, HTML ID, or label for the password input. |
|
|
330
|
+
| `submit` | String | Yes | Button text, value, or ID to click to submit the sign-in form. |
|
|
331
|
+
| `expect` | Mapping | No | Post-login verification: `{ selector: "...", text: "..." }`. Ensures login completed before proceeding. |
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### `shots.<name>`
|
|
336
|
+
|
|
337
|
+
| Key | Type | Required | Description |
|
|
338
|
+
|---|---|---|---|
|
|
339
|
+
| `path` | String | Yes | Path to visit. May contain `%{target}` tokens. |
|
|
340
|
+
| `wait_for` | String | No | CSS selector that must appear on the page before capturing. |
|
|
341
|
+
| `click` | String | No | CSS selector of an element to click before taking the screenshot. |
|
|
342
|
+
| `clip` | Mapping | No | Crop the screenshot to an element bounding box (see [Clip](#clip)). |
|
|
343
|
+
| `expect` | Mapping | No | Verify text presence: `{ selector: "...", text: "..." }`. |
|
|
344
|
+
| `path_script` | String | No | JavaScript expression evaluated in the browser returning a relative path. Useful for dynamic URLs. |
|
|
345
|
+
| `resolved_wait_for` | String | No | Selector to wait for after navigating to the path returned by `path_script`. |
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### `clip`
|
|
350
|
+
|
|
351
|
+
| Key | Type | Default | Description |
|
|
352
|
+
|---|---|---|---|
|
|
353
|
+
| `selector` | String | Required | CSS selector of the element to measure and clip to. |
|
|
354
|
+
| `padding` | Integer | `0` | Padding in pixels added around the element's bounding rect. |
|
|
355
|
+
| `full_width` | Boolean | `false` | When `true`, clips vertically to the element while spanning the full viewport width. |
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
### `images.<name>`
|
|
360
|
+
|
|
361
|
+
Each image entry must set **exactly one** of `path`, `url`, or `page`:
|
|
362
|
+
|
|
363
|
+
| Key | Type | Description |
|
|
364
|
+
|---|---|---|
|
|
365
|
+
| `path` | String | Path to a local image file on disk. No capture step needed. |
|
|
366
|
+
| `url` | String | HTTP or HTTPS URL to download directly. |
|
|
367
|
+
| `page` | String | Webpage URL to visit in headless Chrome. Requires `selector`. |
|
|
368
|
+
| `selector` | String | CSS selector matching an `<img>` tag on `page`. Proofsheet reads its `currentSrc`. |
|
|
369
|
+
|
|
370
|
+
*Note: An image and a shot cannot share the same name because both write `<name>.png`.*
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
### `compositions.<name>`
|
|
375
|
+
|
|
376
|
+
| Key | Type | Required | Description |
|
|
377
|
+
|---|---|---|---|
|
|
378
|
+
| `canvas` | `[width, height]` | Yes | Canvas width and height in pixels. |
|
|
379
|
+
| `background` | String or Mapping | No (default: `"#ffffff"`) | Solid hex color (`"#ffffff"`), image mapping (`image: "path/to/bg.png"`), or gradient mapping (`gradient: ["#c1", "#c2"]`, `angle: 0..360`). |
|
|
380
|
+
| `layers` | Array of Mappings | Yes | List of layers drawn in order from back to front. |
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
### `compositions.<name>.layers[]`
|
|
385
|
+
|
|
386
|
+
Each layer must specify **exactly one** of `shot:` or `image:`:
|
|
387
|
+
|
|
388
|
+
| Key | Type | Default | Description |
|
|
389
|
+
|---|---|---|---|
|
|
390
|
+
| `shot` | String | - | Name of a captured shot to render. |
|
|
391
|
+
| `image` | String | - | Name of a configured image to render. |
|
|
392
|
+
| `x` | Integer | `0` | Horizontal coordinate on the canvas. |
|
|
393
|
+
| `y` | Integer | `0` | Vertical coordinate on the canvas. |
|
|
394
|
+
| `width` | Integer | Source width | Target display width in pixels. Height scales proportionally. |
|
|
395
|
+
| `radius` | Integer | `0` | Corner radius in pixels (applied after scaling). Clamped to half of the smaller dimension. |
|
|
396
|
+
| `rotate` | Integer / Float | `0` | Clockwise rotation angle in degrees. |
|
|
397
|
+
| `shadow` | Boolean or Mapping | `nil` | `true` for standard drop shadow, or `{ x: 0, y: 16, blur: 24, color: "#00000055" }`. |
|
|
398
|
+
| `crop` | Mapping | `nil` | Source cropping before scaling: `{ x: 0, y: 0, width: 800, height: 600 }`. |
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Updating Documentation
|
|
403
|
+
|
|
404
|
+
To re-run all examples and regenerate both the output images and markdown snippets:
|
|
405
|
+
|
|
406
|
+
```sh
|
|
407
|
+
bundle exec rake usage
|
|
408
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
host: "https://en.wikipedia.org"
|
|
2
|
+
|
|
3
|
+
targets:
|
|
4
|
+
article: "Contact_print"
|
|
5
|
+
|
|
6
|
+
defaults:
|
|
7
|
+
viewport: [1440, 900]
|
|
8
|
+
output_dir: "examples/output"
|
|
9
|
+
|
|
10
|
+
shots:
|
|
11
|
+
contact_sheet_lead:
|
|
12
|
+
path: "/wiki/%{article}"
|
|
13
|
+
wait_for: "#firstHeading"
|
|
14
|
+
clip:
|
|
15
|
+
selector: "figure"
|
|
16
|
+
padding: 8
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
host: "https://main.avodemo.com"
|
|
2
|
+
|
|
3
|
+
expect:
|
|
4
|
+
username: "avo@cado.com"
|
|
5
|
+
|
|
6
|
+
credentials:
|
|
7
|
+
username: "env:AVO_DEMO_USERNAME"
|
|
8
|
+
password: "env:AVO_DEMO_PASSWORD"
|
|
9
|
+
|
|
10
|
+
login:
|
|
11
|
+
path: "/users/sign_in"
|
|
12
|
+
username_field: "user_email"
|
|
13
|
+
password_field: "user_password"
|
|
14
|
+
submit: "Sign in"
|
|
15
|
+
expect:
|
|
16
|
+
selector: "body"
|
|
17
|
+
text: "Dashboards"
|
|
18
|
+
|
|
19
|
+
defaults:
|
|
20
|
+
viewport: [1280, 800]
|
|
21
|
+
output_dir: "examples/output"
|
|
22
|
+
|
|
23
|
+
shots:
|
|
24
|
+
avo_dashboard:
|
|
25
|
+
path: "/avo/dashboards/dashy"
|
|
26
|
+
wait_for: "main"
|
|
27
|
+
expect:
|
|
28
|
+
selector: "body"
|
|
29
|
+
text: "Dashy"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
host: "https://example.com"
|
|
2
|
+
|
|
3
|
+
defaults:
|
|
4
|
+
output_dir: "examples/output"
|
|
5
|
+
|
|
6
|
+
shots:
|
|
7
|
+
sample_page:
|
|
8
|
+
path: "/"
|
|
9
|
+
|
|
10
|
+
images:
|
|
11
|
+
cat_placeholder:
|
|
12
|
+
url: "https://placecats.com/300/200"
|
|
13
|
+
|
|
14
|
+
fascination_logo:
|
|
15
|
+
page: "https://fascination.works"
|
|
16
|
+
selector: ".site-logo img"
|
|
17
|
+
|
|
18
|
+
studio_logo:
|
|
19
|
+
path: "examples/assets/logo480.png"
|