Skip to content

Commit b850e0f

Browse files
committed
fix(test): improve error reporting in playwright e2e test
1 parent bb770b7 commit b850e0f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

server/e2e/e2e_chromium_test.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,29 @@ func TestPlaywrightExecuteAPI(t *testing.T) {
776776
require.NoError(t, err, "playwright execute request error: %v", err)
777777
require.Equal(t, http.StatusOK, rsp.StatusCode(), "unexpected status for playwright execute: %s body=%s", rsp.Status(), string(rsp.Body))
778778
require.NotNil(t, rsp.JSON200, "expected JSON200 response, got nil")
779-
require.True(t, rsp.JSON200.Success, "expected success=true, got success=false. Error: %v", rsp.JSON200.Error)
779+
780+
// Log the full response for debugging
781+
if !rsp.JSON200.Success {
782+
var errorMsg string
783+
if rsp.JSON200.Error != nil {
784+
errorMsg = *rsp.JSON200.Error
785+
}
786+
var stdout, stderr string
787+
if rsp.JSON200.Stdout != nil {
788+
stdout = *rsp.JSON200.Stdout
789+
}
790+
if rsp.JSON200.Stderr != nil {
791+
stderr = *rsp.JSON200.Stderr
792+
}
793+
logger.Error("[test]", "error", errorMsg, "stdout", stdout, "stderr", stderr)
794+
}
795+
796+
require.True(t, rsp.JSON200.Success, "expected success=true, got success=false. Error: %s", func() string {
797+
if rsp.JSON200.Error != nil {
798+
return *rsp.JSON200.Error
799+
}
800+
return "nil"
801+
}())
780802
require.NotNil(t, rsp.JSON200.Result, "expected result to be non-nil")
781803

782804
// Verify the result contains "Example Domain" (the title of example.com)

0 commit comments

Comments
 (0)