Skip to content

[visual-testing] Simplify conversion of ExamplesTable to screenshot configuration#6417

Open
valfirst wants to merge 1 commit intomasterfrom
simplify-conversion-of-examples-table-to-screenshot-configuration
Open

[visual-testing] Simplify conversion of ExamplesTable to screenshot configuration#6417
valfirst wants to merge 1 commit intomasterfrom
simplify-conversion-of-examples-table-to-screenshot-configuration

Conversation

@valfirst
Copy link
Collaborator

@valfirst valfirst commented Jan 26, 2026

Summary by CodeRabbit

  • New Features

    • Accept screenshot configuration as a table-based input and support null for "no config" in visual testing steps.
  • Bug Fixes

    • Harmonized visual testing API signatures and unified handling of optional screenshot configurations across modules.
  • Chores

    • Removed legacy converter components and related tests, updated tests and step variants, and adjusted module dependencies.
  • Documentation

    • Added scenario examples demonstrating table-driven screenshot configurations.

@valfirst valfirst requested a review from a team as a code owner January 26, 2026 23:29
@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Removed the generic ExamplesTable→ScreenshotConfiguration converter and its concrete implementations/tests; migrated factories and consumer APIs to accept a nullable ExamplesTable (instead of Optional<ScreenshotConfiguration>), updated internal extraction/validation logic, and adjusted build wiring and tests accordingly.

Changes

Cohort / File(s) Summary
Core: Abstract converter removed
vividus-extension-selenium/src/main/java/org/vividus/ui/converter/AbstractExamplesTableToScreenshotConfigurationConverter.java
Deleted generic abstract converter that converted a single-row ExamplesTable into a ScreenshotConfiguration.
Core: Factory API & logic
vividus-extension-selenium/src/main/java/org/vividus/ui/screenshot/AbstractScreenshotParametersFactory.java, vividus-extension-selenium/src/main/java/org/vividus/ui/screenshot/ScreenshotParametersFactory.java, vividus-extension-selenium/src/test/java/.../AbstractScreenshotParametersFactoryTests.java
Changed ScreenshotParametersFactory to a raw (non-generic) interface; create(...) now accepts @Nullable ExamplesTable instead of Optional<C>; AbstractScreenshotParametersFactory updated to extract/validate a single row from ExamplesTable and added getScreenshotConfigurationClass(); tests updated to mock ExamplesTable.getRowsAs(...).
Concrete converters removed
vividus-plugin-mobile-app/src/main/java/org/vividus/mobileapp/converter/ExamplesTableToScreenshotConfigurationConverter.java, vividus-plugin-web-app/src/main/java/org/vividus/ui/web/converter/ExamplesTableToWebScreenshotConfigurationConverter.java
Removed concrete converter classes that extended the deleted abstract converter.
Spring bean removals
vividus-plugin-mobile-app/src/main/resources/vividus-plugin/spring.xml, vividus-plugin-web-app/src/main/resources/vividus-plugin/spring.xml
Removed bean declarations for the now-deleted converter classes.
Converter tests removed
vividus-extension-selenium/src/test/java/.../AbstractExamplesTableToScreenshotConfigurationConverterTests.java, vividus-plugin-mobile-app/src/test/java/.../ExamplesTableToScreenshotConfigurationConverterTests.java, vividus-plugin-web-app/src/test/java/.../ExamplesTableToWebScreenshotParametersConverterTests.java
Deleted unit tests for the removed converter implementations.
Plugin & factory tests updated
vividus-plugin-mobile-app/src/test/java/.../MobileAppScreenshotParametersFactoryTests.java, vividus-plugin-web-app/src/test/java/.../WebScreenshotParametersFactoryTests.java, vividus-extension-selenium/src/test/java/.../AbstractScreenshotParametersFactoryTests.java
Refactored tests to supply configuration via mocked ExamplesTable and getRowsAs(...); calls adjusted to pass null where previously Optional.empty() was used.
Visual & Applitools: API and usage changes
vividus-plugin-visual/src/main/java/org/vividus/visual/VisualSteps.java, vividus-plugin-visual/src/test/java/.../VisualStepsTests.java, vividus-plugin-applitools/src/main/java/org/vividus/visual/eyes/VisualTestingSteps.java, vividus-plugin-applitools/src/test/java/.../VisualTestingStepsTests.java, vividus-plugin-applitools/src/main/java/.../ExamplesTableToApplitoolsVisualChecksConverter.java, vividus-plugin-applitools/src/test/java/.../ExamplesTableToApplitoolsVisualChecksConverterTests.java
Replaced parameterized ScreenshotParametersFactory<ScreenshotConfiguration> with raw ScreenshotParametersFactory; many public/private methods now accept @Nullable ExamplesTable instead of Optional<ScreenshotConfiguration>/concrete ScreenshotConfiguration; callsites and tests updated.
Build files updated
vividus-plugin-visual/build.gradle, vividus-plugin-applitools/build.gradle
Replaced vividus-plugin-web-app implementation dependency with vividus-extension-selenium; added vividus-plugin-web-app as test dependency in Applitools plugin.
Test coverage & stories
vividus-tests/src/main/resources/story/system/IPadVisualStepsTests.story
Added lifecycle and scenarios using an ExamplesTable-based screenshot configuration parameter.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Steps as VisualSteps / TestingSteps
participant Factory as ScreenshotParametersFactory
participant Table as ExamplesTable
participant Builder as AbstractScreenshotParametersFactory
participant Service as VisualTestingService

Steps->>Factory: create(`@Nullable` ExamplesTable, sourceKey, ignores)
Factory->>Builder: delegate create(...)
Builder->>Table: if not null -> getRowsAs(ConfigClass)
Table-->>Builder: List<Config> (expected single row)
Builder->>Builder: validate single row, merge with defaults, apply ignores
Builder-->>Factory: ScreenshotParameters
Steps->>Service: run visual check with ScreenshotParameters

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.97% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main objective of the changeset: simplifying the conversion of ExamplesTable to screenshot configuration through removal of the converter abstraction and refactoring of the factory interface.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch simplify-conversion-of-examples-table-to-screenshot-configuration

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
vividus-plugin-mobile-app/src/test/java/org/vividus/ui/mobileapp/screenshot/MobileAppScreenshotParametersFactoryTests.java (1)

38-82: Consider adding test coverage for empty ExamplesTable rows.

The tests cover the scenario where ExamplesTable.getRowsAs() returns a single configuration and where ExamplesTable is null, but there's no test for when the table has no rows (empty list). This edge case may be worth covering to ensure the factory handles it gracefully.

🤖 Fix all issues with AI agents
In
`@vividus-extension-selenium/src/test/java/org/vividus/ui/screenshot/AbstractScreenshotParametersFactoryTests.java`:
- Around line 96-99: In the ExamplesTable literal assigned to
screenshotConfiguration in AbstractScreenshotParametersFactoryTests.java there
is a stray "|);" fragment causing a syntax error; remove the erroneous ")"; so
the multi-line text uses proper pipes and ends with the closing triple-quote
immediately after the last row (e.g., "| 1      | 5        | 2       | 3       
|" then closing """), ensuring the ExamplesTable(...) call and the
screenshotConfiguration variable compile correctly.
- Around line 84-89: The ExamplesTable literal in
AbstractScreenshotParametersFactoryTests has a stray "');" inside the
triple-quoted string causing a syntax error; edit the variable
screenshotConfiguration so the multi-line string ends with the row values only
(e.g. "| 1      | 10        | 2       | 3        |") and remove the extraneous
");" from inside the string, then leave the subsequent call to
factory.create(screenshotConfiguration, null, createEmptyIgnores()) unchanged.

In
`@vividus-plugin-applitools/src/main/java/org/vividus/visual/eyes/VisualTestingSteps.java`:
- Around line 182-188: Update the Javadoc for
performCheck(List<ApplitoolsVisualCheck>, ExamplesTable screenshotConfiguration)
to remove the WebScreenshotConfiguration-specific column names (e.g.,
webHeaderToCut, nativeHeaderToCut) and instead state that the
screenshotConfiguration is a generic ExamplesTable whose expected columns depend
on the concrete screenshot configuration implementation (or list
general/required keys if any); reference the performCheck method and the
screenshotConfiguration parameter and mention ApplitoolsVisualCheck so readers
know where the table is used.

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.75%. Comparing base (4c6fde4) to head (1855961).

Files with missing lines Patch % Lines
...creenshot/AbstractScreenshotParametersFactory.java 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6417      +/-   ##
============================================
- Coverage     97.77%   97.75%   -0.02%     
- Complexity     7397     7624     +227     
============================================
  Files          1014     1011       -3     
  Lines         21405    21399       -6     
  Branches       1403     1404       +1     
============================================
- Hits          20928    20919       -9     
- Misses          361      362       +1     
- Partials        116      118       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@valfirst valfirst force-pushed the simplify-conversion-of-examples-table-to-screenshot-configuration branch from fca7f6c to a6a2b44 Compare February 9, 2026 20:09
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@vividus-plugin-web-app/src/test/java/org/vividus/ui/web/screenshot/WebScreenshotParametersFactoryTests.java`:
- Line 105: Replace the inline Map.of(...) call passed to initFactory with the
existing helper createEmptyIgnores() to avoid duplication; specifically, in the
test where initFactory(Map.of(), Map.of(IgnoreStrategy.ELEMENT, Set.of(),
IgnoreStrategy.AREA, Set.of())) is called, pass createEmptyIgnores() for the
second argument (and use the appropriate first argument helper if one exists) so
the test uses the reusable createEmptyIgnores() helper instead of the inline
literal; update the call to initFactory(...) accordingly.

factory.setShootingStrategy(SIMPLE);
factory.setScreenshotConfigurations(new PropertyMappedCollection<>(new HashMap<>()));
factory.setIgnoreStrategies(Map.of(IgnoreStrategy.ELEMENT, Set.of(), IgnoreStrategy.AREA, Set.of()));
initFactory(Map.of(), Map.of(IgnoreStrategy.ELEMENT, Set.of(), IgnoreStrategy.AREA, Set.of()));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Nit: reuse createEmptyIgnores() to avoid duplication.

This inline map literal duplicates the existing createEmptyIgnores() helper on Line 56.

♻️ Suggested diff
-        initFactory(Map.of(), Map.of(IgnoreStrategy.ELEMENT, Set.of(), IgnoreStrategy.AREA, Set.of()));
+        initFactory(Map.of(), createEmptyIgnores());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
initFactory(Map.of(), Map.of(IgnoreStrategy.ELEMENT, Set.of(), IgnoreStrategy.AREA, Set.of()));
initFactory(Map.of(), createEmptyIgnores());
🤖 Prompt for AI Agents
In
`@vividus-plugin-web-app/src/test/java/org/vividus/ui/web/screenshot/WebScreenshotParametersFactoryTests.java`
at line 105, Replace the inline Map.of(...) call passed to initFactory with the
existing helper createEmptyIgnores() to avoid duplication; specifically, in the
test where initFactory(Map.of(), Map.of(IgnoreStrategy.ELEMENT, Set.of(),
IgnoreStrategy.AREA, Set.of())) is called, pass createEmptyIgnores() for the
second argument (and use the appropriate first argument helper if one exists) so
the test uses the reusable createEmptyIgnores() helper instead of the inline
literal; update the call to initFactory(...) accordingly.

@valfirst valfirst force-pushed the simplify-conversion-of-examples-table-to-screenshot-configuration branch from a6a2b44 to 1855961 Compare February 9, 2026 20:55
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 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

Comments