Skip to content

Conversation

@kraenhansen
Copy link
Contributor

Description

Had a need for screenshot while debugging the default connections, which often runs as before hook and therefore won't get screenshotted on failures, as-is.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@kraenhansen kraenhansen self-assigned this Nov 17, 2025
@kraenhansen kraenhansen requested a review from a team as a code owner November 17, 2025 13:33
Copilot AI review requested due to automatic review settings November 17, 2025 13:33
@kraenhansen kraenhansen added no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) labels Nov 17, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds error handling to the setupDefaultConnections function to capture screenshots when connection setup fails during test execution. This is particularly useful since connection setup often runs as a before hook, which doesn't automatically capture screenshots on failure.

  • Wraps the default connection setup loop in a try-catch block
  • Captures a screenshot with an incrementing counter when errors occur during setup
  • Re-throws the error to maintain existing error handling behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.waitForDisplayed({ reverse: true });
}

let screenshotCounter = 0;
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

The module-level screenshotCounter variable will persist across multiple test runs within the same process, potentially causing confusion in screenshot filenames. Consider resetting this counter at appropriate test lifecycle points or including a timestamp in the filename instead.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the exact point of the counter 😆

@kraenhansen kraenhansen merged commit 444d5e1 into main Nov 17, 2025
88 of 89 checks passed
@kraenhansen kraenhansen deleted the kh/connection-form-failure-screenshot branch November 17, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants