From 61491c4203b33d8fbeb83b3a317d29437654cd2e Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Wed, 28 Feb 2024 12:50:43 +0300 Subject: [PATCH 1/2] Added se:cdpVersion to returned capabilities (related to #1405) --- selenoid.go | 8 +++++++- selenoid_test.go | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/selenoid.go b/selenoid.go index 96e50843..439e2244 100644 --- a/selenoid.go +++ b/selenoid.go @@ -9,7 +9,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/aerokube/selenoid/info" "io" "log" "net" @@ -24,6 +23,8 @@ import ( "sync" "time" + "github.com/aerokube/selenoid/info" + "github.com/aerokube/selenoid/event" "github.com/aerokube/selenoid/jsonerror" "github.com/aerokube/selenoid/service" @@ -427,6 +428,11 @@ func processBody(input []byte, host string) ([]byte, string, error) { if c, ok := raw.(map[string]interface{}); ok { sessionId = v["sessionId"].(string) c["se:cdp"] = fmt.Sprintf("ws://%s/devtools/%s/", host, sessionId) + if rbv, ok := c["browserVersion"]; ok { + if bv, ok := rbv.(string); ok { + c["se:cdpVersion"] = bv + } + } } } } diff --git a/selenoid_test.go b/selenoid_test.go index ee09ece2..b6f568d0 100644 --- a/selenoid_test.go +++ b/selenoid_test.go @@ -931,7 +931,7 @@ func TestAddedSeCdpCapability(t *testing.T) { fn := func(input map[string]interface{}) { input["value"] = map[string]interface{}{ "sessionId": input["sessionId"], - "capabilities": make(map[string]interface{}), + "capabilities": map[string]interface{}{"browserVersion": "some-version"}, } delete(input, "sessionId") } @@ -958,6 +958,11 @@ func TestAddedSeCdpCapability(t *testing.T) { assert.True(t, ok) capabilities, ok := rc.(map[string]interface{}) assert.True(t, ok) + rcv, ok := capabilities["se:cdpVersion"] + assert.True(t, ok) + cv, ok := rcv.(string) + assert.True(t, ok) + assert.NotEmpty(t, cv) rws, ok := capabilities["se:cdp"] assert.True(t, ok) ws, ok := rws.(string) From 350e6c83f9b221f505e78ed7a931e7e099a908e6 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Wed, 28 Feb 2024 12:51:23 +0300 Subject: [PATCH 2/2] Bump Golang to 1.22 --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02f25e0d..2e57fc2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.21.6 + go-version: ~1.22.0 - uses: actions/cache@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f79ca457..f5837807 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.21.6 + go-version: ~1.22.0 - uses: actions/cache@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed14f0be..d42325b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v3 with: - go-version: ~1.21.6 + go-version: ~1.22.0 - uses: actions/cache@v3 with: