Skip to content

Commit 88dcd4c

Browse files
committed
Merge branch 'master' into feat/element-is-in-viewport
2 parents 4c8e513 + 94d1c6b commit 88dcd4c

File tree

34 files changed

+3765
-1904
lines changed

34 files changed

+3765
-1904
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/mailru/easyjson v0.9.0
3232
github.com/mattn/go-colorable v0.1.14
3333
github.com/mattn/go-isatty v0.0.20
34-
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa
34+
github.com/mccutchen/go-httpbin/v2 v2.18.3
3535
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd
3636
github.com/mstoykov/envconfig v1.5.0
3737
github.com/mstoykov/k6-taskqueue-lib v0.1.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
129129
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
130130
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
131131
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
132-
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa h1:lx8ZnNPwjkXSzOROz0cg69RlErRXs+L3eDkggASWKLo=
133-
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa/go.mod h1:fhpOYavp5g2K74XDl/ao2y4KvhqVtKlkg1e+0UaQv7I=
132+
github.com/mccutchen/go-httpbin/v2 v2.18.3 h1:DyckIScjHLJtmlSju+rgjqqI1nL8AdMZHsLSljlbnMU=
133+
github.com/mccutchen/go-httpbin/v2 v2.18.3/go.mod h1:GBy5I7XwZ4ZLhT3hcq39I4ikwN9x4QUt6EAxNiR8Jus=
134134
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd h1:AC3N94irbx2kWGA8f/2Ks7EQl2LxKIRQYuT9IJDwgiI=
135135
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd/go.mod h1:9vRHVuLCjoFfE3GT06X0spdOAO+Zzo4AMjdIwUHBvAk=
136136
github.com/mstoykov/envconfig v1.5.0 h1:E2FgWf73BQt0ddgn7aoITkQHmgwAcHup1s//MsS5/f8=

internal/js/modules/k6/browser/common/locator.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ import (
55
"fmt"
66
"strconv"
77
"time"
8-
<<<<<<< HEAD
9-
=======
108
"strings"
119
"github.com/grafana/sobek"
12-
>>>>>>> 8ea4cb8ad (refactor(browser): address PR feedback for isInViewport)
1310

1411
"go.k6.io/k6/internal/js/modules/k6/browser/log"
1512
)

internal/js/modules/k6/browser/tests/page_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,19 +2656,19 @@ func TestPageOnResponse(t *testing.T) {
26562656
AllHeaders: map[string]string{
26572657
"access-control-allow-credentials": "true",
26582658
"access-control-allow-origin": "*",
2659-
"content-length": "10",
2659+
"content-length": "19",
26602660
"content-type": "text/plain; charset=utf-8",
26612661
"date": "Wed, 29 Jan 2025 09:00:00 GMT",
26622662
"x-content-type-options": "nosniff",
26632663
},
2664-
Body: "Not Found\n",
2664+
Body: "404 page not found\n",
26652665
FrameURL: tb.url("/home"),
26662666
AcceptLanguageHeader: "",
26672667
AcceptLanguageHeaders: []string{""},
26682668
Headers: map[string]string{
26692669
"Access-Control-Allow-Credentials": "true",
26702670
"Access-Control-Allow-Origin": "*",
2671-
"Content-Length": "10",
2671+
"Content-Length": "19",
26722672
"Content-Type": "text/plain; charset=utf-8",
26732673
"Date": "Wed, 29 Jan 2025 09:00:00 GMT",
26742674
"X-Content-Type-Options": "nosniff",
@@ -2679,18 +2679,18 @@ func TestPageOnResponse(t *testing.T) {
26792679
{"name": "Access-Control-Allow-Credentials", "value": "true"},
26802680
{"name": "X-Content-Type-Options", "value": "nosniff"},
26812681
{"name": "Access-Control-Allow-Origin", "value": "*"},
2682-
{"name": "Content-Length", "value": "10"},
2682+
{"name": "Content-Length", "value": "19"},
26832683
},
26842684
JSON: "null",
26852685
OK: false,
26862686
RequestURL: tb.url("/favicon.ico"),
26872687
SecurityDetails: common.SecurityDetails{},
26882688
ServerAddr: common.RemoteAddress{IPAddress: host, Port: port},
2689-
Size: map[string]int{"body": 10, "headers": 229},
2689+
Size: map[string]int{"body": 19, "headers": 229},
26902690
Status: 404,
26912691
StatusText: "Not Found",
26922692
URL: tb.url("/favicon.ico"),
2693-
Text: "Not Found\n",
2693+
Text: "404 page not found\n",
26942694
},
26952695
{
26962696
AllHeaders: map[string]string{

internal/js/modules/k6/browser/tests/ws/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
jsonv2 "github.com/go-json-experiment/json"
1919
"github.com/go-json-experiment/json/jsontext"
2020
"github.com/gorilla/websocket"
21-
"github.com/mccutchen/go-httpbin/httpbin"
21+
"github.com/mccutchen/go-httpbin/v2/httpbin"
2222
"github.com/stretchr/testify/require"
2323
"golang.org/x/net/http2"
2424
)

internal/lib/testutils/httpmultibin/httpmultibin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/andybalholm/brotli"
2121
"github.com/gorilla/websocket"
2222
"github.com/klauspost/compress/zstd"
23-
"github.com/mccutchen/go-httpbin/httpbin"
23+
"github.com/mccutchen/go-httpbin/v2/httpbin"
2424
"github.com/stretchr/testify/require"
2525
"golang.org/x/net/http2"
2626
"google.golang.org/grpc"

js/modules/k6/http/batch_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/sirupsen/logrus"
88
"github.com/stretchr/testify/assert"
99
"github.com/stretchr/testify/require"
10+
1011
"go.k6.io/k6/metrics"
1112
)
1213

@@ -360,7 +361,7 @@ func TestBatchGet(t *testing.T) {
360361
var res = http.batch(reqs);
361362
for (var key in res) {
362363
if (res[key].status != 200) { throw new Error("wrong status: " + key + ": " + res[key].status); }
363-
if (res[key].json().data != "testbody" && res[key].json().form.hello != "world!") { throw new Error("wrong response for " + key + ": " + res[key].body); }
364+
if (res[key].json().data != "data:application/octet-stream;base64,dGVzdGJvZHk=" && res[key].json().form.hello != "world!") { throw new Error("wrong response for " + key + ": " + res[key].body); }
364365
}`))
365366
assert.NoError(t, err)
366367
bufSamples := metrics.GetBufferedSamples(samples)

js/modules/k6/http/request_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030

3131
"github.com/andybalholm/brotli"
3232
"github.com/klauspost/compress/zstd"
33-
"github.com/mccutchen/go-httpbin/httpbin"
33+
"github.com/mccutchen/go-httpbin/v2/httpbin"
3434
"github.com/sirupsen/logrus"
3535
"github.com/stretchr/testify/assert"
3636
"github.com/stretchr/testify/require"
@@ -274,11 +274,11 @@ func TestRequest(t *testing.T) {
274274
http.Redirect(w, r, sr("HTTPBIN_URL/post"), http.StatusPermanentRedirect)
275275
}))
276276
_, err := rt.RunString(sr(`
277-
var res = http.post("HTTPBIN_URL/post-redirect", "pesho", {redirects: 1});
277+
var res = http.post("HTTPBIN_URL/post-redirect", "pesho", {redirects: 1, headers: {"Content-Type": "text"}});
278278
279279
if (res.status != 200) { throw new Error("wrong status: " + res.status) }
280280
if (res.url != "HTTPBIN_URL/post") { throw new Error("incorrect URL: " + res.url) }
281-
if (res.json().data != "pesho") { throw new Error("incorrect data : " + res.json().data) }
281+
if (res.json().data != "data:text;base64,cGVzaG8=") { throw new Error("incorrect data : " + res.json().data) }
282282
`))
283283
assert.NoError(t, err)
284284
})
@@ -1074,13 +1074,13 @@ func TestRequest(t *testing.T) {
10741074
})
10751075

10761076
t.Run("name/template", func(t *testing.T) {
1077-
_, err := rt.RunString("http.get(http.url`" + sr(`HTTPBIN_URL/anything/${1+1}`) + "`);")
1077+
_, err := rt.RunString("http.get(http.url`" + sr(`HTTPBIN_URL/anythingwrong/${1+1}`) + "`);")
10781078
assert.NoError(t, err)
1079-
// There's no /anything endpoint in the go-httpbin library we're using, hence the 404,
1079+
// There's no /anythingwrong endpoint in the go-httpbin library we're using, hence the 404,
10801080
// but it doesn't matter for this test.
10811081
//
10821082
// Setting name will overwrite both name and url tags
1083-
assertRequestMetricsEmitted(t, metrics.GetBufferedSamples(samples), "GET", sr("HTTPBIN_URL/anything/${}"), 404, "")
1083+
assertRequestMetricsEmitted(t, metrics.GetBufferedSamples(samples), "GET", sr("HTTPBIN_URL/anythingwrong/${}"), 404, "")
10841084
})
10851085

10861086
t.Run("object", func(t *testing.T) {
@@ -1169,7 +1169,6 @@ func TestRequest(t *testing.T) {
11691169
var res = http.head("HTTPBIN_URL/get?a=1&b=2", {headers: {"X-We-Want-This": "value"}});
11701170
if (res.status != 200) { throw new Error("wrong status: " + res.status); }
11711171
if (res.body.length != 0) { throw new Error("HEAD responses shouldn't have a body"); }
1172-
if (!res.headers["Content-Length"]) { throw new Error("Missing or invalid Content-Length header!"); }
11731172
if (res.request.headers["X-We-Want-This"] != "value") { throw new Error("Missing or invalid X-We-Want-This header!"); }
11741173
`))
11751174
assert.NoError(t, err)
@@ -1212,7 +1211,8 @@ func TestRequest(t *testing.T) {
12121211
_, err := rt.RunString(fmt.Sprintf(sr(`
12131212
var res = http.%s("HTTPBIN_URL/%s", "data", {headers: {"X-We-Want-This": "value"}});
12141213
if (res.status != 200) { throw new Error("wrong status: " + res.status); }
1215-
if (res.json().data != "data") { throw new Error("wrong data: " + res.json().data); }
1214+
var expectedData = "data:application/octet-stream;base64,ZGF0YQ=="
1215+
if (res.json().data != expectedData) { throw new Error("wrong data: " + res.json().data); }
12161216
if (res.json().headers["Content-Type"]) { throw new Error("content type set: " + res.json().headers["Content-Type"]); }
12171217
if (res.request.headers["X-We-Want-This"] != "value") { throw new Error("Missing or invalid X-We-Want-This header!"); }
12181218
`), fn, strings.ToLower(method)))
@@ -2217,13 +2217,13 @@ func TestDigestAuthWithBody(t *testing.T) {
22172217
state.Options.Throw = null.BoolFrom(true)
22182218
state.Options.HTTPDebug = null.StringFrom("full")
22192219

2220-
tb.Mux.HandleFunc("/digest-auth-with-post/", func(w http.ResponseWriter, r *http.Request) {
2220+
tb.Mux.HandleFunc("/digest-auth-with-post/{qop}/{user}/{password}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
22212221
require.Equal(t, http.MethodPost, r.Method)
22222222
body, err := io.ReadAll(r.Body)
22232223
require.NoError(t, err)
22242224
require.Equal(t, "super secret body", string(body))
22252225
httpbin.New().DigestAuth(w, r) // this doesn't read the body
2226-
})
2226+
}))
22272227

22282228
urlWithCreds := tb.Replacer.Replace(
22292229
"http://testuser:testpwd@HTTPBIN_IP:HTTPBIN_PORT/digest-auth-with-post/auth/testuser/testpwd",

lib/netext/httpext/request_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"testing"
1515
"time"
1616

17-
"github.com/mccutchen/go-httpbin/httpbin"
17+
"github.com/mccutchen/go-httpbin/v2/httpbin"
1818
"github.com/sirupsen/logrus"
1919
"github.com/stretchr/testify/assert"
2020
"github.com/stretchr/testify/require"

lib/netext/httpext/tracer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"testing"
1717
"time"
1818

19-
"github.com/mccutchen/go-httpbin/httpbin"
19+
"github.com/mccutchen/go-httpbin/v2/httpbin"
2020
"github.com/stretchr/testify/assert"
2121
"github.com/stretchr/testify/require"
2222

0 commit comments

Comments
 (0)