Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roborazzi AI-Powered Image Assertion #491

Merged
merged 20 commits into from
Nov 3, 2024

Conversation

takahirom
Copy link
Owner

@takahirom takahirom commented Sep 21, 2024

Background

Advancements in AI: AI technologies are becoming increasingly sophisticated and affordable.
Manual Screenshot Testing: Traditional methods require manual verification, limiting scalability.

Problem

Scalability Limitations: Manual checks hinder large-scale screenshot testing.
High Maintenance Costs: Human intervention increases effort and costs.

Proposal

Integrate AI for Image Comparison: Use AI to automate screenshot verification in tests.
Enhance Roborazzi: Add AiOptions to enable AI-based image evaluation.

Current code

https://github.com/takahirom/roborazzi/blob/658bb293e7beb163f5004d1f09987f35f0294064/docs/topics/ai_powered_image_assertion.md

image

Changes for Existing Projects

We won't introduce any new dependencies for existing projects. I think I'll add the roborazzi-ai module to manage dependencies like Gemini or others, so you don't have to worry about disrupting existing dependencies.

Discussion Points

When We Execute This

The current AI implementation runs only when:

  • AiOptions are set
    • Because we can't run without prompts and API keys
  • Comparing or verifying tasks
  • The image is changed with ImageComparator
    • Because I think we can save a lot of money if we check only when images are changed.

And the test fails only when:

  • All above conditions are met
  • requiredFulfillmentPercent is set
  • It doesn't fulfill
  • (These tests fail even if it's a compare task.)

How We Set Prompts

Currently, it is a little difficult to set a prompt because we need to change RoborazziOptions.CompareOptions.AiOptions.prompt.

Things to Do

  • Get feedback from someone
  • Decide on the name of this feature
  • Decide if it is okay to have prompt in RoborazziOptions.CompareOptions. If we create a new function for this, like captureRoboImageWithAI, it will require bigger changes. Alternatively, provide a way to change these options easily for RoborazziOptions.

@takahirom takahirom force-pushed the takahirom/roborazzi-ai-prototype/2024-09-21 branch 2 times, most recently from 58046c3 to 6ef71df Compare October 21, 2024 01:05
@takahirom takahirom changed the title Roborazzi AI prototype Roborazzi AI-Powered Image Verification prototype Oct 22, 2024
@takahirom takahirom force-pushed the takahirom/roborazzi-ai-prototype/2024-09-21 branch from 1ce5650 to b58c5ff Compare October 22, 2024 02:44
@takahirom
Copy link
Owner Author

takahirom commented Oct 22, 2024

TODO:

  • Add a test using AiModel.Manual
  • remove loadRoboAi()
  • Separate roborazzi-ai into roborazzi-ai and roborazzi-ai-gemini

@takahirom takahirom changed the title Roborazzi AI-Powered Image Verification prototype Roborazzi AI-Powered Image Verification Oct 25, 2024
@takahirom takahirom force-pushed the takahirom/roborazzi-ai-prototype/2024-09-21 branch from f90a2dc to 3fdebb6 Compare October 28, 2024 11:16
@takahirom takahirom force-pushed the takahirom/roborazzi-ai-prototype/2024-09-21 branch from d345482 to 93ffc7b Compare October 31, 2024 01:33
@takahirom takahirom changed the title Roborazzi AI-Powered Image Verification Roborazzi AI-Powered Image Assertion Nov 3, 2024
Repository owner deleted a comment from github-actions bot Nov 3, 2024
@takahirom takahirom merged commit e4387b5 into main Nov 3, 2024
6 of 7 checks passed
@takahirom takahirom deleted the takahirom/roborazzi-ai-prototype/2024-09-21 branch November 3, 2024 07:47
@takahirom takahirom restored the takahirom/roborazzi-ai-prototype/2024-09-21 branch November 3, 2024 07:47
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