microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[wip] API review 1.11 #1357

Closed pavelfeldman closed 3 years ago

pavelfeldman commented 3 years ago

Browser

BrowserContext

BrowserType

Devices

FileChooser

JSHandle

Page

Request

Response

Route

WebSocket

Generic questions

kblok commented 3 years ago

Task OpenerAsync() should be sync

@pavelfeldman do you want resume the conversation here https://github.com/microsoft/playwright/pull/6408 ?

kblok commented 3 years ago

@pavelfeldman description updated based on issues that were already created or created after going through your comments. A few questions:

Document newContext

What do you mean by that?

  • [ ] [nit, open] Do we want Accept/Dismiss to be Async?

They involve communication with the driver. They should be async.

  • [ ] Response.statusCode - what is that?

It's a map of the int code to httpstatuscode https://docs.microsoft.com/en-us/dotnet/api/system.net.httpstatuscode?view=net-5.0. Users will prefer this over an int. We could either leave it like this or change the docs upstream to generate only the httpstatuscode version.

  • [ ] Tests use TaskUtils.WhenAll (similar to Promise.all) - do we want java-style callbacks instead?

I would like you to show me some examples there. But my feeling is that a C# is way more closer to a TypeScript than a Java coding style.

  • [ ] Threading model. We use ConfigureAwait(false) everywhere which means our code runs on unpredictable threads. Therefore we use ConcurrentDictionary in many places. Should we also use concurrent lists instead of arrays? Is there any way to protect against concurrent use of our APIs? What are our threading assumptions/guarantees?

I think that all our arrays comes already "cooked" from the driver. If you saw any array that we are building from several driver messages we DO need to take a look at it.

getter vs method

I think that if it sounds like a property, and we can generate a property, why not?

Can we await in route handler? I did not find a test for this.

We can't. We are doing fire and forgets on those callbacks now. I would wait for some specific requests here. That would be an overload.

pavelfeldman commented 3 years ago

@pavelfeldman do you want resume the conversation here microsoft/playwright#6408 ?

No, why?

kblok commented 3 years ago

Can we close this @pavelfeldman ?