Skip to content

Conversation

louis030195
Copy link
Contributor

Pull Request Template

Description

Ensures that tests reliably close any applications or browser tabs they open, even if the test fails or panics. This prevents resource leaks and improves test isolation by using RAII-style CloseOnDrop guards.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other:

Video Demo (Recommended)

🎥 Not applicable for this change, as it's an internal test infrastructure improvement.

AI Review & Code Quality

  • I asked AI to critique my PR and incorporated feedback
  • I formatted my code properly
  • I tested my changes locally

Checklist

  • Code follows project style guidelines
  • Added video demo (Not applicable)
  • Updated documentation if needed

Additional Notes

Implemented CloseOnDrop in:

  • terminator/tests/click_timing_regression_test.rs
  • terminator/tests/open_url.rs
  • terminator/tests/open_url_unit_tests.rs

This is the first batch of changes; further updates to workflow-recorder tests and e2e_tests.rs are planned.


Open in Cursor Open in Web

Introduces CloseOnDrop struct to automatically close UIElement instances when they go out of scope, preventing resource leaks in tests.

Co-authored-by: louis.beaumont <[email protected]>
Copy link

cursor bot commented Sep 9, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@louis030195 louis030195 marked this pull request as ready for review September 9, 2025 18:47
@louis030195 louis030195 merged commit 07c14b4 into main Sep 9, 2025
1 of 3 checks passed
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, please upgrade to Bugbot Pro by visiting the Cursor dashboard. Your first 14 days will be free!


match engine.open_url(url, Some(browser.clone())) {
Ok(element) => {
let _guard = CloseOnDrop(&element);
Copy link

Choose a reason for hiding this comment

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

Bug: CloseOnDrop Prematurely Closes Browser Windows

The CloseOnDrop guard in test_multiple_browser_windows and test_open_url_browser_detection closes browser windows immediately after opening them. This prevents these tests from correctly verifying scenarios that rely on windows remaining open for subsequent steps, like enumerating applications or counting multiple active browser instances.

Additional Locations (2)

Fix in Cursor Fix in Web

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.

2 participants