Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/notte-browser/src/notte_browser/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def __init__(
persona: BasePersona | None = None,
window: BrowserWindow | None = None,
keep_alive: bool = False,
open_viewer: bool = False,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 No test added for this bug fix

This PR fixes a real bug (ValidationError when passing open_viewer to a local session) but adds no unit or integration test. Per the repository's test guidelines, at least one integration test is required for every bug fix. A minimal test that constructs NotteSession(open_viewer=True) or NotteSession(open_viewer=False) and verifies no ValidationError is raised would cover this path and prevent regression.

Context Used: # Test guidelines

  • Add a comment if the PR does n... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/notte-browser/src/notte_browser/session.py
Line: 132

Comment:
**No test added for this bug fix**

This PR fixes a real bug (`ValidationError` when passing `open_viewer` to a local session) but adds no unit or integration test. Per the repository's test guidelines, at least one integration test is required for every bug fix. A minimal test that constructs `NotteSession(open_viewer=True)` or `NotteSession(open_viewer=False)` and verifies no `ValidationError` is raised would cover this path and prevent regression.

**Context Used:** # Test guidelines
- Add a comment if the PR does n... ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a parametrized regression test (test_open_viewer_does_not_raise_validation_error) that constructs NotteSession(open_viewer=True) and NotteSession(open_viewer=False), verifying no ValidationError is raised. CI is green.

**data: Unpack[SessionStartRequestDict],
) -> None:
if storage is not None and storage.is_remote:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ async def alist_downloaded_files(self) -> list[FileInfo]:
_ = NotteSession(storage=_FakeRemoteStorage())


@pytest.mark.parametrize("open_viewer", [True, False])
def test_open_viewer_does_not_raise_validation_error(open_viewer: bool):
"""open_viewer must be consumed before **data reaches SessionStartRequest.model_validate()."""
session = NotteSession(open_viewer=open_viewer)
# If we get here, no ValidationError was raised
assert session is not None


def test_captcha_solver_not_available_error():
with pytest.raises(CaptchaSolverNotAvailableError):
_ = NotteSession(solve_captchas=True, browser_type="chrome")
Expand Down
Loading