Extension example catches its own assertions and cannot detect failed deletion

Open Beginner friendly
#180 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
testing-qa

Research direction

Start with the two deletion-verification blocks in examples/playwright_extensions.py:127-132 and 134-143, then inspect how examples/e2e/test_playwright.py exercises the example. Ensure unexpected success is not treated as an expected failure, and run the relevant E2E test to verify deletion regressions are detected.

Written by the indexing model from the issue text.

Description

Description

The extension example's two deletion-verification blocks catch their own AssertionError. If retrieving a deleted extension or creating a session with it unexpectedly succeeds, the code raises AssertionError, immediately catches it with except Exception, and prints that failure occurred "as expected".

Code reference

  • examples/playwright_extensions.py:127-132
  • examples/playwright_extensions.py:134-143

Reproduction

The control-flow problem can be demonstrated without Browserbase credentials:

try:
    # Simulate get_extension() unexpectedly succeeding.
    object()
    raise AssertionError("Expected to fail when retrieving deleted extension")
except Exception as exc:
    print(f"Failed as expected: {exc}")

The output claims an expected failure even though the operation succeeded and only the example's own assertion failed.

Expected behavior

Only the API operation should be inside the try, with the success assertion in else, or the code should catch the specific expected Browserbase exception. Unexpected success must fail the example/E2E test.

Actual behavior

Both negative checks are guaranteed to print an expected-failure message for either outcome, so regressions in extension deletion can pass silently.

Why it matters

examples/e2e/test_playwright.py exercises this example. False-positive cleanup checks weaken E2E coverage for deletion semantics and can mask a server or SDK regression.

Dominant language
Python
Stars
93
Forks
16
Avg merge
11m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from browserbase/sdk-python

All issues in browserbase/sdk-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.