You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,12 +135,41 @@ default:
135
135
always_fullscreen: true
136
136
```
137
137
138
+
### Capturing Screenshots After Every Step
139
+
140
+
To automatically capture a screenshot after every step, you can either:
141
+
142
+
1. **Enable globally** in configuration:
143
+
144
+
```yaml
145
+
default:
146
+
extensions:
147
+
DrevOps\BehatScreenshotExtension:
148
+
on_every_step: true
149
+
```
150
+
151
+
2. **Enable per-scenario** using the `@screenshots` tag:
152
+
153
+
```gherkin
154
+
@screenshots
155
+
Scenario: My scenario with automatic screenshots
156
+
Given I am on "http://example.com"
157
+
When I click "Login"
158
+
Then I should see "Welcome"
159
+
# Screenshots will be captured after each of these steps
160
+
```
161
+
162
+
The `@screenshots` tag takes precedence over the global configuration, allowing you to enable this feature for specific scenarios even when it's disabled globally.
163
+
164
+
**Note**: When both `on_every_step` and `on_failed` are enabled, only one screenshot is captured for failed steps (the failed screenshot) to avoid duplicates.
| `dir` | `%paths.base%/screenshots` | Path to directory to save screenshots. Directory structure will be created if the directory does not exist. Override with `BEHAT_SCREENSHOT_DIR` env var. |
| `on_every_step` | `false` | Automatically capture screenshots after every step. Can be enabled globally via config or per-scenario using the `@screenshots` tag. Only captures on passed steps to avoid duplicates with `on_failed`. |
144
173
| `purge` | `false` | Remove all files from the screenshots directory on each test run. Useful during debugging of tests. |
145
174
| `always_fullscreen` | `false` | Always use fullscreen screenshot capture for all screenshot steps, including regular screenshot steps. When enabled, all `I save screenshot` steps will behave like `I save fullscreen screenshot`. |
146
175
| `fullscreen_algorithm` | `resize` | Algorithm to use for fullscreen screenshots. Options: `resize`(temporarily resizes browser window to full page height) or `stitch` (captures multiple screenshots while scrolling and stitches them together). The stitch algorithm requires GD extension but produces higher quality results. |
0 commit comments