docs(java): initialize Page in API testing examples - #42399
Conversation
Yury Semikhatsky (yury-s)
left a comment
There was a problem hiding this comment.
I'd not make any of the changes to keep the examples short. We can add // ... where the classes omit some code, but nobody complained so far.
|
|
||
| private Playwright playwright; | ||
| private APIRequestContext request; | ||
| private Browser browser; |
There was a problem hiding this comment.
These has nothing to do with the api request, I'd not add them here to keep only the code that is relevant to the api request in the example.
| @BeforeAll | ||
| void beforeAll() { | ||
| createPlaywright(); | ||
| createBrowser(); |
There was a problem hiding this comment.
this also doesn't help with understanding the api testing.
this PR is in response to someone filing an issue about how it's confusing so that's not really true anymore |
They complain that "As a result, readers cannot run these UI-interaction snippets directly after adapting the complete example." and I believe complete example from the docs is in a good shape. The rest are just bits that zoom in to the relevant parts of the snippets. I'd not try to make them perfect. I'm also pretty sure agents won't have any troubles with turning the doc into runnable code. If you still want to add fixtures, they should be local to "Prepare server state via API calls" and "Check the server state after running user actions" sections which actually use |
the browser integration examples used `Page` without initializing it create a local `Browser` and `Page` in each integration example
5a6e31f to
014f62d
Compare
the browser integration examples used
Pagewithout initializing itshare one
Browserand create an isolatedBrowserContextandPagefor each testfixes #42368