Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some logging and comments making it easier to debug with chrome #1882

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/integration/supervisor_login_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package integration
Expand Down Expand Up @@ -2966,6 +2966,15 @@ func startLocalCallbackServer(t *testing.T) *localCallbackServer {
// Handle the callback by sending the *http.Request object back through a channel.
callbacks := make(chan *http.Request, 1)
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
t.Logf("got request at localhost callback listener with method %s, URL %s headers: %#v", r.Method, r.URL.String(), r.Header)

if r.Method == http.MethodGet && r.URL.Path == "/favicon.ico" {
// Chrome will request favicons. The favicon request will come after the authcode request.
// 404 those requests rather than hanging on the channel send below.
w.WriteHeader(http.StatusNotFound)
return
}

callbacks <- r
}))
server.URL += "/callback"
Expand Down
14 changes: 13 additions & 1 deletion test/testlib/browsertest/browsertest.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

// Package browsertest provides integration test helpers for our browser-based tests.
Expand Down Expand Up @@ -56,10 +56,22 @@
options := append(
// Start with the defaults.
chromedp.DefaultExecAllocatorOptions[:],

Check warning on line 59 in test/testlib/browsertest/browsertest.go

View check run for this annotation

Codecov / codecov/patch

test/testlib/browsertest/browsertest.go#L59

Added line #L59 was not covered by tests
// Add "ignore-certificate-errors" Chrome flag.
chromedp.IgnoreCertErrors,

Check warning on line 62 in test/testlib/browsertest/browsertest.go

View check run for this annotation

Codecov / codecov/patch

test/testlib/browsertest/browsertest.go#L62

Added line #L62 was not covered by tests
// Uncomment this to watch the browser while the test runs.
// chromedp.Flag("headless", false), chromedp.Flag("hide-scrollbars", false), chromedp.Flag("mute-audio", false),

// Uncomment this to automatically open the devtools window when the browser opens. Helpful when not headless.
// chromedp.Flag("auto-open-devtools-for-tabs", true),

// Uncomment one of these lines (and update path if needed) to use
// Google Chrome Beta (download from https://www.google.com/chrome/beta/)
// when running integration tests on your local machine.
// These are the default paths for macOS and Linux, respectively.
// chromedp.ExecPath("/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"),
// chromedp.ExecPath("/usr/bin/google-chrome-beta"),

Check warning on line 74 in test/testlib/browsertest/browsertest.go

View check run for this annotation

Codecov / codecov/patch

test/testlib/browsertest/browsertest.go#L65-L74

Added lines #L65 - L74 were not covered by tests
)

if runtime.GOOS != "darwin" && runtime.GOOS != "windows" {
Expand Down
Loading