• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

playwright-community / playwright-go / 28128818799

24 Jun 2026 08:48PM UTC coverage: 77.112% (-1.4%) from 78.514%
28128818799

Pull #581

github

mxschmitt
fix(cdp): preserve upstream timing defaults for missing fields

Merge the timing initializer over the defaults pre-seeded in newRequest
instead of overwriting every field with 0.0, mirroring upstream's
Object.assign(request._timing, initializer.timing). This keeps the
correct -1 defaults for fields the server omits and also guards the
top-level timing object, which some CDP implementations omit entirely.

Add unit tests for the timing merge helper and an integration test for
response timing.
Pull Request #581: fix(cdp): handle missing timing fields in the response from CDP

19 of 19 new or added lines in 2 files covered. (100.0%)

143 existing lines in 13 files now uncovered.

7769 of 10075 relevant lines covered (77.11%)

4388.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.28
/objectFactory.go
1
package playwright
2

3
// dummyObject is a placeholder for unimplemented protocol objects (Android, Electron, etc.)
4
type dummyObject struct {
5
        channelOwner
6
}
7

8
func newDummyObject(parent *channelOwner, objectType string, guid string, initializer map[string]any) *dummyObject {
180✔
9
        d := &dummyObject{}
180✔
10
        d.createChannelOwner(d, parent, objectType, guid, initializer)
180✔
11
        return d
180✔
12
}
180✔
13

14
func createObjectFactory(parent *channelOwner, objectType string, guid string, initializer map[string]any) any {
38,077✔
15
        switch objectType {
38,077✔
16
        case "Android":
90✔
17
                return newDummyObject(parent, objectType, guid, initializer)
90✔
18
        case "AndroidSocket":
×
19
                return newDummyObject(parent, objectType, guid, initializer)
×
20
        case "AndroidDevice":
×
21
                return newDummyObject(parent, objectType, guid, initializer)
×
22
        case "APIRequestContext":
3,676✔
23
                return newAPIRequestContext(parent, objectType, guid, initializer)
3,676✔
24
        case "Artifact":
66✔
25
                return newArtifact(parent, objectType, guid, initializer)
66✔
26
        case "BindingCall":
5,880✔
27
                return newBindingCall(parent, objectType, guid, initializer)
5,880✔
28
        case "Browser":
125✔
29
                return newBrowser(parent, objectType, guid, initializer)
125✔
30
        case "BrowserType":
270✔
31
                return newBrowserType(parent, objectType, guid, initializer)
270✔
32
        case "BrowserContext":
3,511✔
33
                return newBrowserContext(parent, objectType, guid, initializer)
3,511✔
34
        case "Debugger":
3,511✔
35
                return newDebugger(parent, objectType, guid, initializer)
3,511✔
UNCOV
36
        case "CDPSession":
×
UNCOV
37
                return newCDPSession(parent, objectType, guid, initializer)
×
38
        case "Dialog":
29✔
39
                return newDialog(parent, objectType, guid, initializer)
29✔
40
        case "Electron":
90✔
41
                return newDummyObject(parent, objectType, guid, initializer)
90✔
42
        case "ElectronApplication":
×
43
                return newDummyObject(parent, objectType, guid, initializer)
×
44
        case "ElementHandle":
666✔
45
                return newElementHandle(parent, objectType, guid, initializer)
666✔
46
        case "Frame":
3,867✔
47
                return newFrame(parent, objectType, guid, initializer)
3,867✔
48
        case "JSHandle":
1,391✔
49
                return newJSHandle(parent, objectType, guid, initializer)
1,391✔
50
        case "JsonPipe":
78✔
51
                return newJsonPipe(parent, objectType, guid, initializer)
78✔
52
        case "LocalUtils":
18✔
53
                localUtils := newLocalUtils(parent, objectType, guid, initializer)
18✔
54
                if localUtils.connection.localUtils == nil {
30✔
55
                        localUtils.connection.localUtils = localUtils
12✔
56
                }
12✔
57
                return localUtils
18✔
58
        case "Page":
3,597✔
59
                return newPage(parent, objectType, guid, initializer)
3,597✔
60
        case "Playwright":
90✔
61
                return newPlaywright(parent, objectType, guid, initializer)
90✔
62
        case "Request":
3,125✔
63
                return newRequest(parent, objectType, guid, initializer)
3,125✔
64
        case "Response":
3,038✔
65
                return newResponse(parent, objectType, guid, initializer)
3,038✔
66
        case "Route":
803✔
67
                return newRoute(parent, objectType, guid, initializer)
803✔
68
        case "Selectors":
×
69
                return newSelectorsOwner(parent, objectType, guid, initializer)
×
70
        case "SocksSupport":
×
71
                return nil
×
72
        case "Stream":
12✔
73
                return newStream(parent, objectType, guid, initializer)
12✔
74
        case "Tracing":
3,676✔
75
                return newTracing(parent, objectType, guid, initializer)
3,676✔
76
        case "WebSocket":
54✔
77
                return newWebsocket(parent, objectType, guid, initializer)
54✔
78
        case "WebSocketRoute":
30✔
79
                return newWebSocketRoute(parent, objectType, guid, initializer)
30✔
80
        case "Worker":
54✔
81
                return newWorker(parent, objectType, guid, initializer)
54✔
82
        case "WritableStream":
42✔
83
                return newWritableStream(parent, objectType, guid, initializer)
42✔
84
        // Disposable objects are sent by the driver but not exposed in Go API.
85
        // Methods returning Disposable in JS return only error in Go.
86
        case "Disposable":
288✔
87
                return newDisposable(parent, objectType, guid, initializer)
288✔
88
        default:
×
89
                panic(objectType)
×
90
        }
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc