Skip to content

Commit bf89349

Browse files
committed
[#173] Removed deprecated 'fullscreen_algorithm' option and stitch algorithm.
1 parent bd94117 commit bf89349

13 files changed

Lines changed: 16 additions & 433 deletions

CLAUDE.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ composer test # Run PHPUnit tests without coverage
2323
- Coverage reports are generated in .logs/coverage directory
2424

2525
## Recent Improvements
26-
- Added support for fullscreen screenshots with two algorithms:
27-
- Stitch algorithm (default): Takes multiple screenshots while scrolling and stitches them together
28-
- Resize algorithm: Temporarily resizes browser window to capture full page
26+
- Fullscreen screenshots use the resize algorithm (temporarily resizes browser window to capture full page)
2927
- Updated autoloader from PSR-0 to PSR-4
3028
- Made constants public as per PHP 8.2+ standards
3129
- Improved error messages for file operations
@@ -37,7 +35,7 @@ composer test # Run PHPUnit tests without coverage
3735
The Behat Screenshot extension provides functionality to capture screenshots during Behat test runs. Its main components are:
3836

3937
1. **BehatScreenshotExtension**: Handles configuration and service container integration
40-
2. **ScreenshotContext**: Provides Behat steps and screenshot capabilities, including fullscreen screenshot functionality with both stitch and resize algorithms
38+
2. **ScreenshotContext**: Provides Behat steps and screenshot capabilities, including fullscreen screenshot functionality
4139
3. **Tokenizer**: Processes dynamic filename generation with tokens
4240

4341
## Best Practices for Contributing

README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ default:
6969
on_failed: true
7070
purge: false
7171
always_fullscreen: false
72-
fullscreen_algorithm: resize # Options: 'stitch' or 'resize'
7372
failed_prefix: 'failed_'
7473
filename_pattern: '{datetime:u}.{feature_file}.feature_{step_line}.{ext}'
7574
filename_pattern_failed: '{datetime:u}.{failed_prefix}{feature_file}.feature_{step_line}.{ext}'
@@ -89,24 +88,8 @@ Given I am on "http://google.com"
8988
Then I save fullscreen screenshot
9089
```
9190

92-
There are two algorithms available for capturing fullscreen screenshots:
93-
94-
1. **Resize** (default): Temporarily resizes the browser window to the full height of the
95-
page to capture everything in one screenshot. This is faster, but may cause
96-
layout issues on some pages.
97-
98-
2. **Stitch**: Takes multiple screenshots while scrolling the page and
99-
stitches them together. This produces high-quality results with proper
100-
content rendering but requires the GD extension.
101-
102-
You can configure which algorithm to use via the `fullscreen_algorithm` option:
103-
104-
```yaml
105-
default:
106-
extensions:
107-
DrevOps\BehatScreenshotExtension:
108-
fullscreen_algorithm: resize # Options: 'stitch' or 'resize'
109-
```
91+
Fullscreen screenshots work by temporarily resizing the browser window to the
92+
full height of the page to capture everything in one screenshot.
11093

11194
You may optionally specify the size of the browser window in the screenshot
11295
step:
@@ -173,7 +156,6 @@ The `@screenshots` tag takes precedence over the global configuration, allowing
173156
| `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`. |
174157
| `purge` | `false` | Remove all files from the screenshots directory on each test run. Useful during debugging of tests. |
175158
| `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`. |
176-
| `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. |
177159
| `info_types` | `url`, `feature`, `step`, `datetime` | Show additional information on screenshots. Comma-separated list of `url`, `feature`, `step`, `datetime`, or remove to disable. Ordered as listed. |
178160
| `failed_prefix` | `failed_` | Prefix failed screenshots with `failed_` string. Useful to distinguish failed and intended screenshots. |
179161
| `filename_pattern` | `{datetime:u}.{feature_file}.feature_{step_line}.{ext}` | File name pattern for successful assertions. |

behat.yml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ default:
1111
on_every_step: false # Capture screenshot after every step
1212
purge: false
1313
always_fullscreen: false
14-
fullscreen_algorithm: resize # 'stitch' (only if GD ext available) or 'resize'
1514
info_types:
1615
- url
1716
- feature

src/DrevOps/BehatScreenshotExtension/Context/Initializer/ScreenshotContextInitializer.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ class ScreenshotContextInitializer implements ContextInitializer {
3535
* Always take fullscreen screenshots.
3636
* @param bool $onEveryStep
3737
* Capture screenshot after every step.
38-
* @param string $fullscreenAlgorithm
39-
* Algorithm to use for fullscreen screenshots. This parameter is
40-
* deprecated and will be ignored. The algorithm is now always set to
41-
* 'resize'.
4238
* @param string $filenamePattern
4339
* File name pattern.
4440
* @param string $filenamePatternFailed
@@ -55,7 +51,6 @@ public function __construct(
5551
protected bool $purge,
5652
protected bool $alwaysFullscreen,
5753
protected bool $onEveryStep,
58-
protected string $fullscreenAlgorithm,
5954
protected string $filenamePattern,
6055
protected string $filenamePatternFailed,
6156
protected array $infoTypes = [],
@@ -83,7 +78,6 @@ public function initializeContext(Context $context): void {
8378
$this->failedPrefix,
8479
$this->alwaysFullscreen,
8580
$this->onEveryStep,
86-
$this->fullscreenAlgorithm,
8781
$this->filenamePattern,
8882
$this->filenamePatternFailed,
8983
$this->infoTypes

src/DrevOps/BehatScreenshotExtension/Context/ScreenshotAwareContextInterface.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ interface ScreenshotAwareContextInterface extends Context {
2424
* Always take fullscreen screenshots.
2525
* @param bool $on_every_step
2626
* Capture screenshot after every step.
27-
* @param string $fullscreen_algorithm
28-
* Algorithm to use for fullscreen screenshots. This parameter is
29-
* deprecated and will be ignored. The algorithm is now always set to
30-
* 'resize'.
3127
* @param string $filename_pattern
3228
* File name pattern.
3329
* @param string $filename_pattern_failed
@@ -37,7 +33,7 @@ interface ScreenshotAwareContextInterface extends Context {
3733
*
3834
* @return $this
3935
*/
40-
public function setScreenshotParameters(string $dir, bool $on_failed, string $failed_prefix, bool $always_fullscreen, bool $on_every_step, string $fullscreen_algorithm, string $filename_pattern, string $filename_pattern_failed, array $info_types): static;
36+
public function setScreenshotParameters(string $dir, bool $on_failed, string $failed_prefix, bool $always_fullscreen, bool $on_every_step, string $filename_pattern, string $filename_pattern_failed, array $info_types): static;
4137

4238
/**
4339
* Save screenshot content into a file.

0 commit comments

Comments
 (0)