Fix chromedriver usage inside our test container.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2020-10-14 12:33:52 -05:00
parent 19a1d569c9
commit 68d20298f2
No known key found for this signature in database
GPG Key ID: EAE88AD172C5AE2D

View File

@ -152,6 +152,22 @@ func TestCLILoginOIDC(t *testing.T) {
// Find the login CSS selectors for the test issuer, or fail fast. // Find the login CSS selectors for the test issuer, or fail fast.
loginProvider := getLoginProvider(t) loginProvider := getLoginProvider(t)
// Start the browser driver.
t.Logf("opening browser driver")
agoutiDriver := agouti.ChromeDriver(
agouti.ChromeOptions("args", []string{
"--no-sandbox",
"--headless", // Comment out this line to see the tests happen in a visible browser window.
}),
// Uncomment this to see stdout/stderr from chromedriver.
// agouti.Debug,
)
require.NoError(t, agoutiDriver.Start())
t.Cleanup(func() { require.NoError(t, agoutiDriver.Stop()) })
page, err := agoutiDriver.NewPage(agouti.Browser("chrome"))
require.NoError(t, err)
require.NoError(t, page.Reset())
// Build pinniped CLI. // Build pinniped CLI.
t.Logf("building CLI binary") t.Logf("building CLI binary")
pinnipedExe := buildPinnipedCLI(t) pinnipedExe := buildPinnipedCLI(t)
@ -222,17 +238,6 @@ func TestCLILoginOIDC(t *testing.T) {
return readAndExpectEmpty(reader) return readAndExpectEmpty(reader)
}) })
// Start the browser driver.
t.Logf("opening browser driver")
agoutiDriver := agouti.ChromeDriver(
// Comment out this line to see the tests happen in a visible browser window.
agouti.ChromeOptions("args", []string{"--headless"}),
)
require.NoError(t, agoutiDriver.Start())
t.Cleanup(func() { require.NoError(t, agoutiDriver.Stop()) })
page, err := agoutiDriver.NewPage(agouti.Browser("chrome"))
require.NoError(t, err)
// Wait for the CLI to print out the login URL and open the browser to it. // Wait for the CLI to print out the login URL and open the browser to it.
t.Logf("waiting for CLI to output login URL") t.Logf("waiting for CLI to output login URL")
var loginURL string var loginURL string