From 034b87517da0358e40f5f79f3a5a2d91f8d041d7 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Thu, 10 Jul 2025 15:54:52 +0300 Subject: [PATCH 1/4] k6/browser: call page.close() in some cases it was missed --- internal/js/modules/k6/browser/tests/page_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/js/modules/k6/browser/tests/page_test.go b/internal/js/modules/k6/browser/tests/page_test.go index 1395b628269..c1cd2496dc1 100644 --- a/internal/js/modules/k6/browser/tests/page_test.go +++ b/internal/js/modules/k6/browser/tests/page_test.go @@ -20,10 +20,10 @@ import ( "github.com/grafana/sobek" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - k6metrics "go.k6.io/k6/metrics" "go.k6.io/k6/internal/js/modules/k6/browser/common" "go.k6.io/k6/internal/js/modules/k6/browser/k6ext/k6test" + "go.k6.io/k6/metrics" ) type emulateMediaOpts struct { @@ -248,6 +248,8 @@ func TestPageEvaluateMapping(t *testing.T) { tt.script, ) assert.Equal(t, tb.vu.ToSobekValue(tt.want), got.Result()) + // Test script as string input + _ = tb.vu.RunPromise(t, `await p.close()`) }) } } @@ -1813,6 +1815,7 @@ func TestShadowDOMAndDocumentFragment(t *testing.T) { //nolint:tparallel }); const text = await s.innerText(); + await p.close() return text; `, tb.staticURL("shadow_and_doc_frag.html"), tt.selector) assert.Equal(t, tt.want, got.Result().String()) @@ -2085,7 +2088,7 @@ func TestPageOnMetric(t *testing.T) { done := make(chan bool) - samples := make(chan k6metrics.SampleContainer) + samples := make(chan metrics.SampleContainer) // This page will perform many pings with a changing h query parameter. // This URL should be grouped according to how page.on('metric') is used. tb := newTestBrowser(t, withHTTPServer(), withSamples(samples)) From ff23a82283b91b4439be43b8fa41b32543bd2322 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Thu, 10 Jul 2025 15:56:16 +0300 Subject: [PATCH 2/4] TestSetIntervalOrder: bump a timeout to be less flaky in CI --- internal/js/tc55/timers/timers_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/js/tc55/timers/timers_test.go b/internal/js/tc55/timers/timers_test.go index 43a46a27df4..a0c94ec3b87 100644 --- a/internal/js/tc55/timers/timers_test.go +++ b/internal/js/tc55/timers/timers_test.go @@ -116,7 +116,7 @@ func TestSetIntervalOrder(t *testing.T) { clearInterval(two); clearInterval(three); clearInterval(last); - }, 4); + }, 10); var three = setInterval((_) => print("three"), 1); print("outside"); `) From c1b012fe14c0bb81e2a4af95983b1c35ca87bead Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Thu, 10 Jul 2025 17:09:04 +0300 Subject: [PATCH 3/4] TestShadowDOMAndDocumentFragment: do not reuse testbrowser for stability --- internal/js/modules/k6/browser/tests/page_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/js/modules/k6/browser/tests/page_test.go b/internal/js/modules/k6/browser/tests/page_test.go index c1cd2496dc1..2d513b6b0df 100644 --- a/internal/js/modules/k6/browser/tests/page_test.go +++ b/internal/js/modules/k6/browser/tests/page_test.go @@ -1764,14 +1764,11 @@ func TestPageIsHidden(t *testing.T) { } } -func TestShadowDOMAndDocumentFragment(t *testing.T) { //nolint:tparallel +func TestShadowDOMAndDocumentFragment(t *testing.T) { t.Parallel() if runtime.GOOS == "windows" { - t.Skip() // timeouts + t.Skip("windows timeouts on these tests") } - - tb := newTestBrowser(t, withFileServer()) - tests := []struct { name string selector string @@ -1798,8 +1795,10 @@ func TestShadowDOMAndDocumentFragment(t *testing.T) { //nolint:tparallel }, } - for _, tt := range tests { //nolint:paralleltest + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() + tb := newTestBrowser(t, withFileServer()) tb.vu.ActivateVU() tb.vu.StartIteration(t) defer tb.vu.EndIteration(t) From f432c88c635be1cc2d281782c3b2f71ad3af6b05 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Tue, 22 Jul 2025 14:54:19 +0300 Subject: [PATCH 4/4] ci: run less concurrently on ARM for more stability --- .github/workflows/test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bd125ea9311..e5d86c0d437 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,8 +47,8 @@ jobs: go version export GOMAXPROCS=2 args=("-p" "2" "-race") - # Run with less concurrency on Windows/MacOS to minimize flakiness. - if [[ "${{ matrix.platform }}" == windows* || "${{ matrix.platform }}" == macos* ]]; then + # Run with less concurrency on Windows/MacOS/ARM to minimize flakiness. + if [[ "${{ matrix.platform }}" == windows* || "${{ matrix.platform }}" == macos* || "${{ matrix.platform }}" == *arm ]]; then unset args[2] args[1]="1" export GOMAXPROCS=1 @@ -92,8 +92,8 @@ jobs: go version export GOMAXPROCS=2 args=("-p" "2" "-race") - # Run with less concurrency on Windows/MacOS to minimize flakiness. - if [[ "${{ matrix.platform }}" == windows* || "${{ matrix.platform }}" == macos* ]]; then + # Run with less concurrency on Windows/MacOS/ARM to minimize flakiness. + if [[ "${{ matrix.platform }}" == windows* || "${{ matrix.platform }}" == macos* || "${{ matrix.platform }}" == *arm ]]; then unset args[2] args[1]="1" export GOMAXPROCS=1 @@ -131,8 +131,8 @@ jobs: go version export GOMAXPROCS=2 args=("-p" "2" "-race") - # Run with less concurrency on Windows/MacOS to minimize flakiness. - if [[ "${{ matrix.platform }}" == windows* || "${{ matrix.platform }}" == macos* ]]; then + # Run with less concurrency on Windows/MacOS/ARM to minimize flakiness. + if [[ "${{ matrix.platform }}" == windows* || "${{ matrix.platform }}" == macos* || "${{ matrix.platform }}" == *arm ]]; then unset args[2] args[1]="1" export GOMAXPROCS=1