Skip to content

Removed dulicate saveScreenshots func - #362

Draft
enes-0 wants to merge 1 commit into
pedrovgs:masterfrom
enes-0:parallel-to-consecutive6.1.0
Draft

Removed dulicate saveScreenshots func#362
enes-0 wants to merge 1 commit into
pedrovgs:masterfrom
enes-0:parallel-to-consecutive6.1.0

Conversation

@enes-0

@enes-0 enes-0 commented Apr 14, 2026

Copy link
Copy Markdown

!!!Not finalized!!!

-Removed parallel comparison

📌 References

🎩 What is the goal?

Fix heap memory issues in the Shot library that occur when running screenshot tests with large image differences, causing OutOfMemoryError.

How is it being implemented?

  1. ScreenshotsSaver.saveTemporalScreenshots: Previously, saveScreenshots was called twice — once to save to the temporal path and effectively again to save to the report folder. Replaced the second saveScreenshots call with FileUtils.copyDirectory, which copies the already-written files to the report folder instead of recomposing and re-encoding all screenshots into memory a second time.

  2. ScreenshotsComparator.compare: Changed screenshots.par.flatMap(...) to screenshots.flatMap(...), removing parallel collection usage. Parallel comparison loads multiple screenshot pairs into memory simultaneously, which multiplies heap usage. Sequential comparison processes one screenshot at a time, trading execution speed for significantly lower peak memory consumption.

How can it be tested?

If it cannot be tested explain why.

  • Use case 1: Run screenshot verification tests with a large suite of screenshots that previously caused an OutOfMemoryError — the tests should now complete without heap errors.
  • Use case 2: Run screenshot recording and verification end-to-end to confirm temporal screenshots and report folder screenshots are still generated correctly.
    • Record screenshots (executeScreenshotTests -Precord)
    • Verify screenshots (executeScreenshotTests) and confirm the report folder contains the expected images.

-Removed parallel comparison
@enes-0
enes-0 marked this pull request as draft April 14, 2026 10:22
@enes-0 enes-0 closed this Apr 14, 2026
@enes-0 enes-0 reopened this Apr 14, 2026
@enes-0 enes-0 changed the title -Removed dulicate saveScreenshots func Removed dulicate saveScreenshots func Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant