From e93a4a7644da609d01ef5634bb6ec85c8244779a Mon Sep 17 00:00:00 2001 From: Arne Luenser Date: Wed, 4 Nov 2026 18:28:55 +0100 Subject: [PATCH] test: keep TestCommandHelper fixtures intact for parallel subtests func=Authenticate closed the shared Playwright browser as soon as its own login finished, while func=ListProjects, running in parallel, could still be logging in through it, which then failed with "target closed". The browser is now only closed by the parent's t.Cleanup, after all subtests have finished. func=SelectProjectWorkspace changed the project and workspace selected in the shared config file, which func=CreateProject copies in parallel. It now works on a copy of its own. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DUBUDsgicGQri3GxrTV8VW --- cmd/cloudx/client/command_helper_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/cloudx/client/command_helper_test.go b/cmd/cloudx/client/command_helper_test.go index a8fc4443..2c05bcef 100644 --- a/cmd/cloudx/client/command_helper_test.go +++ b/cmd/cloudx/client/command_helper_test.go @@ -57,6 +57,8 @@ func TestCommandHelper(t *testing.T) { email, password, name := testhelpers.RegisterAccount(ctx, t) + // Parallel subtests log in through this browser, so it may only be closed + // once all of them have finished, which is when t.Cleanup runs. browser, page, cleanup := testhelpers.SetupPlaywright(t) t.Cleanup(cleanup) authenticated, err := client.NewCommandHelper( @@ -87,6 +89,8 @@ func TestCommandHelper(t *testing.T) { t.Run("func=SelectProjectWorkspace", func(t *testing.T) { t.Parallel() + // Selecting rewrites the config file, which the parallel subtests share. + ctx, _ := testhelpers.WithDuplicatedConfigFile(ctx, t, defaultConfigFile) h, err := client.NewCommandHelper(ctx) require.NoError(t, err) otherWorkspace, err := h.CreateWorkspace(ctx, "other workspace") @@ -237,9 +241,6 @@ func TestCommandHelper(t *testing.T) { require.NoError(t, h.Authenticate(ctx)) t.Logf("authentication successful") - // we don't need playwright anymore - cleanup() - // assert success config, err := h.GetAuthenticatedConfig(ctx) require.NoError(t, err)