From 48b58e2fad5627df3ed6451c9b7f1bddf6b96cc0 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Tue, 13 Jul 2021 16:20:02 -0700 Subject: [PATCH] Clear the browser cookies between each TestE2EFullIntegration test It seems like page.ClearCookies() only clears cookies for the current domain, so there doesn't seem to be a function to clear all browser cookies. Instead, we'll just start a whole new browser each test. They start fast enough that it shouldn't be a problem. --- test/integration/e2e_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/integration/e2e_test.go b/test/integration/e2e_test.go index 5102d59d..fd631822 100644 --- a/test/integration/e2e_test.go +++ b/test/integration/e2e_test.go @@ -57,9 +57,6 @@ func TestE2EFullIntegration(t *testing.T) { pinnipedExe := testlib.PinnipedCLIPath(t) tempDir := testutil.TempDir(t) - // Start the browser driver. - page := browsertest.Open(t) - // Infer the downstream issuer URL from the callback associated with the upstream test client registration. issuerURL, err := url.Parse(env.SupervisorUpstreamOIDC.CallbackURL) require.NoError(t, err) @@ -110,6 +107,9 @@ func TestE2EFullIntegration(t *testing.T) { // Add an OIDC upstream IDP and try using it to authenticate during kubectl commands. t.Run("with Supervisor OIDC upstream IDP and automatic flow", func(t *testing.T) { + // Start a fresh browser driver because we don't want to share cookies between the various tests in this file. + page := browsertest.Open(t) + expectedUsername := env.SupervisorUpstreamOIDC.Username expectedGroups := env.SupervisorUpstreamOIDC.ExpectedGroups @@ -271,6 +271,9 @@ func TestE2EFullIntegration(t *testing.T) { }) t.Run("with Supervisor OIDC upstream IDP and manual flow", func(t *testing.T) { + // Start a fresh browser driver because we don't want to share cookies between the various tests in this file. + page := browsertest.Open(t) + expectedUsername := env.SupervisorUpstreamOIDC.Username expectedGroups := env.SupervisorUpstreamOIDC.ExpectedGroups