gemini-testing / gemini-testing/testplane

Ability to keep browser after tests are done executing

Open
#1,096 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
830
Forks
76
Avg merge
4d 10h
Merged PRs (30d)
14

Description

### Contribution

- [ ] I'd be willing to implement this feature ([contributing guide](https://github.com/gemini-testing/hermione/blob/master/CONTRIBUTING.md))

### Describe the user story

Two possible applications for this:

- Debugging something locally, after test fails, you can still interact with the browser and see what's wrong

- When using AI agents, let the agent run test to perform some complex logic, e.g. custom authentication command, then attach to browser via MCP and perform some actions

Why this is not REPL?

- For user it's similar indeed, with exception of unconiditonal `--keep-browser`. But for AI agents it's quite different: it's a lot more difficult to force AI to use REPL the way humans do, it's much easier to say "write test with the same beforeEach as in this file and run it to prepare browser".

### Describe the solution you'd like

API:

`--keep-browser` — unconditionally do not close browser session on tests end
`--keep-browser-on-fail` — the same, but only when test has failed

Just as REPL, these options must only be available when only 1 test is launched in only 1 browser.

Also, at the very end, a message to stdio must be written about the fact that the browser won't be closed and all info needed to attach to it. For example:
```
Testplane run has finished, but the browser won't be closed, because you passed the --keep-browser argument. You may attach to this browser using the following capabilities:
{
sessionId: "...",
capabilities: { ... },
sessionOptions: { ... }
}
```

See existing-browser `attach()` call to find out more about the shape of this object.

### Describe the drawbacks of your solution

_No response_

### Describe alternatives you've considered

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.