Closed tristanlabelle closed 1 year ago
This is awesome. This is the sort of thing I'm talking about when I say we should cleanup prior to open sourcing. Don't you feel a lot better about it now? I do!
Also: did you test this against BrowserWin? Just to make sure we didn't break stuff over there?
@jeffdav Yeah, I have had this API shape in mind for a while and it feels better!
Also: did you test this against BrowserWin? Just to make sure we didn't break stuff over there?
No, but this cannot immediately break BrowserWin thanks to https://github.com/thebrowsercompany/arc/blob/eeeaba1ff34884cecb44c64e0b50f805f69a6c2c/Apps/BrowserWin/Package.resolved#L170 . We might have to do some tweaks next time we update packages. Also, I have a few more improvements in mind ;)
Changes
WebDriverRequests
"namespace" (aka enum)Session+Requests.swift
andElement+Requests.swift
, moving the functions toSession.swift
andElement.swift
WebDriverRequest
associatedtype
ResponseValue
for in favor of having onlyResponse
, which now defaults toCodableNone
.WebDriverRequests.ResponseWithValue<Value>
can be specified as theResponse
type when it follows the typical shape of having a singlevalue
property.Rationale
This is one further step towards clarifying the layering clear between:
WebDriver
protocol implementations and request structs. The library can be used exclusively at that layer if needed.Session
andElement
. This layer sits on top of the low-level layer, mostly without exposing it, to provide a more OOP API.It also makes it easier to see the list of requests structs we have implemented, and makes the
Session
andElement
definitions clearer by being just a list of funcs for each supported operation.