Skip to content

AllureSelenide: use Selenide.screenshot for screenshots so Photographer plugins apply - #1440

Merged
baev merged 5 commits into
allure-framework:mainfrom
USSQA:main
Nov 3, 2026
Merged

baev merged 5 commits into
allure-framework:mainfrom
USSQA:main

Conversation

@USSQA

@USSQA USSQA commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Context

Fixes #1439

AllureSelenide.getScreenshotBytes() currently bypasses Selenide and calls ((TakesScreenshot) WebDriverRunner.getWebDriver()).getScreenshotAs(OutputType.BYTES) directly on the raw WebDriver. As a result, Selenide plugins that customize the Photographer (e.g. selenide-full-screenshot) are ignored, so screenshots attached to Allure reports don't match the screenshots Selenide itself produces elsewhere in the test suite and are not full page screenshots as users expect.

This change replaces the direct WebDriver call with Selenide.screenshot(OutputType.BYTES), which:

  • routes the screenshot through Selenide's configured Photographer, so plugins like selenide-full-screenshot apply consistently to Allure attachments
  • handles the "no WebDriver started" case internally by returning null, which is mapped to Optional.empty() via Optional.ofNullable, preserving the existing behavior of the removed WebDriverRunner.hasWebDriverStarted() guard
  • keeps the existing WebDriverException handling unchanged

No public API changes, behavior is identical for the default Photographer.

Checklist

@baev baev added the pr:improvement Change that improves some user experience but can't be considered as a new feature label Sep 17, 2026
@baev

baev commented Sep 17, 2026

Copy link
Copy Markdown
Member

@USSQA thanks!

can you please add a test for the change?

@CLAassistant

CLAassistant commented Sep 17, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…r plugin

- add test with a custom Photographer registered via SPI, asserting its bytes end up in the Allure attachment
- add test that a driver without TakesScreenshot support does not break step reporting
- add TestPhotographer fixture and META-INF/services registration
@USSQA

USSQA commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@baev done ✅

@USSQA

USSQA commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@baev it looks like the build checks failed because of a temporary Eclipse outage. We ran the allure-selenide tests locally and everything seems to still work fine, so should be able to just re-run those failing build checks.

@USSQA

USSQA commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@baev looks like the issue happened again and is affecting other PRs aside from this one. When you get a chance could you please rerun the failed checks and babysit it for a sec in case they need to be restarted again? Would really love to get this change pushed forward. Thank you 🙏

@baev

baev commented Nov 2, 2026

Copy link
Copy Markdown
Member

@USSQA

FAILURE: Build failed with an exception.
548 actionable tasks: 548 executed

* What went wrong:
Execution failed for task ':allure-selenide:spotlessJavaCheck' (registered in build file 'build.gradle.kts').
> The following files had format violations:
      src/test/java/io/qameta/allure/selenide/TestPhotographer.java
          @@ -43,4 +43,3 @@
           ················:·Optional.empty();
           ····}
           }
          -
  Run './gradlew spotlessApply' to fix all violations.

@USSQA

USSQA commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@baev fixed ✅

@baev
baev merged commit 48e8810 into allure-framework:main Nov 3, 2026
5 checks passed
@baev

baev commented Nov 3, 2026

Copy link
Copy Markdown
Member

@USSQA thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Change that improves some user experience but can't be considered as a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AllureSelenide should use Selenide's screenshot implementation instead of Selenium WebDriver's implementation

3 participants