Skip to content

Conversation

@mmmay0722
Copy link
Collaborator

  • Add screenshots_paths support alongside base64 screenshots in test results
  • Implement screenshot prefix context variable to prevent filename collisions in parallel execution
  • Improve screenshot session management with better directory organization
  • Update case executor to support case_id and handle screenshot paths
  • Enhance function tester and UX tester with screenshot path tracking
  • Bump version to 0.2.3

…ion support

- Add screenshots_paths support alongside base64 screenshots in test results
- Implement screenshot prefix context variable to prevent filename collisions in parallel execution
- Improve screenshot session management with better directory organization
- Update case executor to support case_id and handle screenshot paths
- Enhance function tester and UX tester with screenshot path tracking
- Bump version to 0.2.3
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mmmay0722, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the test reporting capabilities by overhauling how screenshots are captured, stored, and integrated into test results. It introduces the ability to save screenshots as local files, alongside base64 data, and implements a robust system for organizing these files to prevent naming conflicts, especially in parallel execution environments. The changes also include enhancements to the test result data models, allowing for more detailed and structured reporting, and optimize data storage by separating monitoring information. These improvements collectively aim to provide a more comprehensive, flexible, and efficient reporting experience for test runs.

Highlights

  • Enhanced Screenshot Handling: Introduced support for saving screenshots as local files, alongside the existing base64 encoding. This provides more flexibility for reporting and debugging.
  • Improved Screenshot Organization: Implemented a new directory structure for screenshots within reports and added a context variable (screenshot_prefix_var) to prevent filename collisions during parallel test execution, ensuring unique and organized screenshot storage.
  • Flexible Report Directory Configuration: Users can now specify a custom report directory via the report_dir configuration option, allowing for greater control over where test results and associated assets are stored.
  • Refined Test Result Data Structure: The SubTestScreenshot model now includes an optional label field, and case_id is properly tracked in SubTestResult, enhancing the detail and clarity of test reports.
  • Optimized Data Storage for Reports: Monitoring data (console errors, network requests) is now saved to separate JSON files (*_monitor.json) to reduce the size of the main test result JSONs, improving performance and manageability.
  • Version Bump: The project version has been updated to 0.2.3 across package.json, pyproject.toml, and webqa_agent/__init__.py.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly enhances screenshot handling by introducing support for saving screenshots as files instead of just base64 strings. This is a great improvement for performance and report management. The changes include better directory organization for reports, collision avoidance for filenames in parallel execution, and updates across various modules to support screenshot paths. The implementation is thorough and well-thought-out. I've provided a few suggestions to further improve robustness and maintainability.

timestamp = datetime.datetime.now().strftime('%H%M%S')
# Use high-precision timestamp and random suffix to avoid collisions in parallel execution
now = datetime.datetime.now()
timestamp = now.strftime('%H%M%S')
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current timestamp format for screenshot filenames has only second-level precision. In scenarios with high-frequency screenshot captures, especially during parallel test execution, this could lead to filenames that don't reflect the true chronological order if multiple screenshots are taken within the same second. Using a more precise timestamp would improve debugging and log analysis.

I suggest including microseconds in the timestamp to ensure unique and correctly ordered filenames.

Suggested change
timestamp = now.strftime('%H%M%S')
timestamp = now.strftime('%H%M%S_%f')

Comment on lines 630 to 632
# Store raw monitoring data as a temporary attribute for later saving
# This allows us to save it separately without modifying the data model
setattr(result, '_raw_monitoring_data', monitoring_data)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using setattr to dynamically add an attribute to a Pydantic model instance can make the code harder to understand and maintain, as the attribute is not part of the model's defined schema. This can lead to issues with static analysis, type checking, and IDE support.

A more robust approach would be to either include _raw_monitoring_data as an optional, private field in the SubTestResult model (e.g., using PrivateAttr from Pydantic) or to return the monitoring data alongside the result object in a tuple from _build_case_result. This would make the data flow more explicit and type-safe.

Comment on lines 144 to 148
report_dir = report_config.get('report_dir') if report_config else None
# Handle null, None, empty string, or missing value
if not report_dir or (isinstance(report_dir, str) and report_dir.strip() == ''):
# Use default reports/{timestamp}/ directory
report_dir = f'reports/test_{report_ts}'
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This logic for resolving the report directory is duplicated in webqa_agent/executor/parallel_mode.py (lines 76-81). To improve maintainability and adhere to the DRY (Don't Repeat Yourself) principle, consider extracting this logic into a shared utility function. This function could take the report configuration and a timestamp as input and return the resolved report directory path.

token = test_id_var.set(log_context)

# Set screenshot prefix to avoid filename collisions in parallel execution
from webqa_agent.actions.action_handler import \
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以考虑放在顶部

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

os.environ['WEBQA_REPORT_TIMESTAMP'] = report_ts

# Initialize screenshot directory for this test session
from webqa_agent.actions.action_handler import ActionHandler
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

token = test_id_var.set(test_config.test_name)

# Set screenshot prefix to avoid collisions. LangGraph workers will override this with case_id.
from webqa_agent.actions.action_handler import screenshot_prefix_var
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

token = test_id_var.set(log_context)

# Set screenshot prefix to avoid filename collisions in parallel execution
from webqa_agent.actions.action_handler import \
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

@mmmay0722 mmmay0722 merged commit 0745ace into dev_0.2.3 Jan 12, 2026
@mmmay0722 mmmay0722 deleted the mjw/dev_0.2.3 branch January 12, 2026 11:45
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.

3 participants