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

Commit

Permalink
Ability to print labels from extension capabilities (fixes #339)
Browse files Browse the repository at this point in the history
  • Loading branch information
vania-pooh committed Mar 22, 2021
1 parent cf79a10 commit e1e1e57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ func (c caps) capabilities(fn func(m map[string]interface{}, w3c bool)) {
if alwaysMatch, ok := m[keys.alwaysMatch]; ok {
if m, ok := alwaysMatch.(map[string]interface{}); ok {
fn(m, true)
for k, v := range m { // Extension capabilities have ":" in key
if ec, ok := v.(map[string]interface{}); ok && strings.Contains(k, ":") {
fn(ec, true)
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ func TestStartSessionWithDefaultVersionW3C(t *testing.T) {
mux.HandleFunc("/wd/hub/session", postOnly(func(w http.ResponseWriter, r *http.Request) {
body, _ := ioutil.ReadAll(r.Body)
r.Body.Close()
var sess map[string]map[string]map[string]string
var sess map[string]map[string]map[string]interface{}
err := json.Unmarshal(body, &sess)
w.Write([]byte(`{"sessionId":"123"}`))
AssertThat(t, err, Is{nil})
Expand Down Expand Up @@ -911,7 +911,7 @@ func TestStartSessionWithDefaultVersionW3C(t *testing.T) {
}}}}
updateQuota(user, browsers)

createSession(`{"capabilities":{"alwaysMatch":{"browserName":"browser"}}}`)
createSession(`{"capabilities":{"alwaysMatch":{"browserName":"browser", "selenoid:options": {"labels": {"some-key": "some-value"}}}}}`)
}

func TestClientClosedConnection(t *testing.T) {
Expand Down

0 comments on commit e1e1e57

Please sign in to comment.