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

Introduce kittest for automated UI testing and git-lfs for UI snapshot handling #8182

Merged
merged 24 commits into from
Nov 29, 2024

Conversation

lucasmerlin
Copy link
Contributor

@lucasmerlin lucasmerlin commented Nov 19, 2024

What

  • Integrates egui_kittest for automated UI testing, including snapshot testing
  • Update egui to latest main
  • Introduces git-lfs to the repo.
    • Add instructions in BUILD.md
    • Improve check_large_files.py to verify that all PNGs are indeed handled by git-lfs.
  • Run mac rust tests on main to cover for the UI snapshot tests
  • Related: Use a software renderer for kittest #8245

NOTE: I (@abey79) repeat: introduce git-lfs to the repo.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide
  • Run tests in CI
  • Setup git lfs

To run all checks from main, comment on the PR with @rerun-bot full-check.

To deploy documentation changes immediately after merging this PR, add the deploy docs label.

Copy link

github-actions bot commented Nov 27, 2024

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link
722fa53 https://rerun.io/viewer/pr/8182

Note: This comment is updated whenever you push a commit.

@abey79 abey79 added ui concerns graphical user interface 🔨 testing testing and benchmarks exclude from changelog PRs with this won't show up in CHANGELOG.md labels Nov 27, 2024
Copy link

github-actions bot commented Nov 27, 2024

Latest documentation preview deployed successfully.

Result Commit Link
722fa53 https://landing-bg8co3i6u-rerun.vercel.app/docs

Note: This comment is updated whenever you push a commit.

@abey79 abey79 marked this pull request as ready for review November 27, 2024 18:30
@abey79 abey79 changed the title Add kittest and time panel snapshot test Introduce kittest for automated UI testing and git-lfs for UI snapshot handling Nov 27, 2024
@emilk emilk requested review from emilk November 28, 2024 08:03
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

I'm very excited to get this in!

});
});
}

pub fn run_simple(&self, egui_ctx: &egui::Context, func: impl FnOnce(&ViewerContext<'_>)) {
Copy link
Member

Choose a reason for hiding this comment

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

This should have a docstring. I also don't understand the naming.

It's more like the previous run should be called run_ui, and this run_test or just run?

Copy link
Member

Choose a reason for hiding this comment

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

Does this even need to be pub?

Copy link
Member

Choose a reason for hiding this comment

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

I'm reshuffling/improving things here. I'm expecting that this will further evolve when we better integrate this with kittest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this even need to be pub?

Yeah, since we use it in re_time_panel

Copy link
Member

@abey79 abey79 Nov 28, 2024

Choose a reason for hiding this comment

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

I think we have:

  • run (does just the basic non-ui thing, takes a FnOnce(&ViewerContex))
  • run_in_egui_central_panel (legacy thing that use __run_test_ctx and takes FnMut(&ViewerContext, Ui)). This should probably go away in the future.
  • some form of a run_with_kittest() (for a future PR)

All of these should handle_system_command(), so we can get rid of run_and_handle_system_commands().

I'm updating this PR according to this.

edit: for clarity, we use run in the existing kittest test, by manually rolling the kittest stuff in the closure.

Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

I'm very excited to get this in!

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12067771530

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12068811066

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12072739603

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12073470333

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12073556187

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12073654214

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

Last run attempt did work correctly CI-wise, but test failed. Looks like a git-lfs thing

image

@abey79
Copy link
Member

abey79 commented Nov 28, 2024

@rerun-bot full-check

Copy link

@abey79
Copy link
Member

abey79 commented Nov 29, 2024

finally...

image

Unclear about nightly as its been broken for a week.

@abey79 abey79 merged commit 97b9e44 into main Nov 29, 2024
70 checks passed
@abey79 abey79 deleted the lucas/add-kittest branch November 29, 2024 07:56
abey79 added a commit that referenced this pull request Feb 7, 2025
### Related

- Related to #8182 

### What

Introduce a new helper to manage and visualise failed kittest snapshot
tests using Rerun.

```
pixi run snapshots --help

# view all failed snapshot
pixi run snapshots

# remove all failed snapshot temp files
pixi run snapshots --clean

# only view (or clean) snapshot for that crate
pixi run snapshots -p re_time_panel
```


https://github.com/user-attachments/assets/c2ad63be-ff85-4235-a161-a359ff540d89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md 🔨 testing testing and benchmarks ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants