Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Added se:cdpVersion capability support #1408

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading