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

playwright-community / playwright-go / 28253241734

26 Jun 2026 05:05PM UTC coverage: 78.979% (+0.09%) from 78.892%
28253241734

Pull #617

github

mxschmitt
test: fix cross-browser client-cert/websocket assertions and lint

- client-cert handshake-abort error wording varies by browser AND platform
  (chromium ERR_BAD_SSL_CLIENT_AUTH_CERT, firefox SSL_ERROR_UNKNOWN, webkit
  'Certificate is required' on linux/macos / 'Failure when receiving data' on
  windows); match any known variant
- Firefox websocket error is now ': 404' like other browsers (was
  CLOSE_ABNORMAL) since v1.61
- replace deprecated WaitForTimeout with time.Sleep; check Close/Stop returns
Pull Request #617: chore: roll to Playwright v1.61.1

135 of 162 new or added lines in 11 files covered. (83.33%)

4 existing lines in 2 files now uncovered.

8743 of 11070 relevant lines covered (78.98%)

6279.64 hits per line

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

51.72
/errors.go
1
package playwright
2

3
import (
4
        "errors"
5
        "fmt"
6
)
7

8
var (
9
        // ErrPlaywright wraps all Playwright errors.
10
        //   - Use errors.Is to check if the error is a Playwright error.
11
        //   - Use errors.As to cast an error to [Error] if you want to access "Stack".
12
        ErrPlaywright = errors.New("playwright")
13
        // ErrTargetClosed usually wraps a reason.
14
        ErrTargetClosed = errors.New("target closed")
15
        // ErrTimeout wraps timeout errors. It can be either Playwright TimeoutError or client timeout.
16
        ErrTimeout = errors.New("timeout")
17
)
18

19
// Error represents a Playwright error
20
type Error struct {
21
        Name    string `json:"name"`
22
        Message string `json:"message"`
23
        Stack   string `json:"stack"`
24
}
25

26
func (e *Error) Error() string {
1,155✔
27
        return e.Message
1,155✔
28
}
1,155✔
29

30
func (e *Error) Is(target error) bool {
×
31
        err, ok := target.(*Error)
×
32
        if !ok {
×
33
                return false
×
34
        }
×
35
        if err.Name != e.Name {
×
36
                return false
×
37
        }
×
38
        if e.Name != "Error" {
×
39
                return true // same name and not normal error
×
40
        }
×
41
        return e.Message == err.Message
×
42
}
43

44
func parseError(err Error) error {
1,155✔
45
        switch err.Name {
1,155✔
46
        case "TimeoutError":
96✔
47
                return fmt.Errorf("%w: %w: %w", ErrPlaywright, ErrTimeout, &err)
96✔
48
        case "TargetClosedError":
239✔
49
                return fmt.Errorf("%w: %w: %w", ErrPlaywright, ErrTargetClosed, &err)
239✔
50
        }
51
        return fmt.Errorf("%w: %w", ErrPlaywright, &err)
820✔
52
}
53

54
func targetClosedError(reason *string) error {
5,779✔
55
        if reason == nil {
11,550✔
56
                return ErrTargetClosed
5,771✔
57
        }
5,771✔
58
        return fmt.Errorf("%w: %s", ErrTargetClosed, *reason)
8✔
59
}
60

61
// errorWithDetails wraps a server error that also carries structured
62
// errorDetails and a call log. Since v1.61 assertion `expect` failures are
63
// reported this way instead of as a `{ matches: false }` result;
64
// locatorImpl.expect unwraps it via errors.As to rebuild the expect result.
65
type errorWithDetails struct {
66
        err     error
67
        details map[string]any
68
        log     []string
69
}
70

NEW
71
func (e *errorWithDetails) Error() string { return e.err.Error() }
×
72

NEW
73
func (e *errorWithDetails) Unwrap() error { return e.err }
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc