Skip to content

Commit

Permalink
Merge pull request #1408 from vania-pooh/master
Browse files Browse the repository at this point in the history
Added se:cdpVersion capability support
  • Loading branch information
vania-pooh committed Feb 28, 2024
2 parents fd32287 + 350e6c8 commit 2538009
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion selenoid.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/aerokube/selenoid/info"
"io"
"log"
"net"
Expand All @@ -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"
Expand Down Expand Up @@ -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
}
}
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion selenoid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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)
Expand Down

0 comments on commit 2538009

Please sign in to comment.