diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-14 13:18:54 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-14 13:18:54 -0600 |
| commit | 4b2d609a0efcc1d9b2f1a08f954d067ad1d9cd1e (patch) | |
| tree | 0afacf9217b0569130da6b97d4197331681bf119 /test/integration/ui.go | |
| parent | ab373d1fe698cd3f53258c09bc8515d88a6d0b9e (diff) | |
test: use playwright to test out an OIDC login
Diffstat (limited to 'test/integration/ui.go')
| -rw-r--r-- | test/integration/ui.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/integration/ui.go b/test/integration/ui.go new file mode 100644 index 0000000..1af0744 --- /dev/null +++ b/test/integration/ui.go @@ -0,0 +1,33 @@ +package test + +import ( + "testing" + + playwright "github.com/playwright-community/playwright-go" + "github.com/stretchr/testify/require" + "github.com/xlgmokha/x/pkg/env" + "github.com/xlgmokha/x/pkg/x" +) + +func WithUI(t *testing.T, callback x.Visitor[playwright.Browser]) { + t.Run("UI", func(t *testing.T) { + if isGitlabCI(t) { + t.Skip() + } + _ = playwright.Install() + + driver, err := playwright.Run() + require.NoError(t, err) + + browser, err := driver.Firefox.Launch(playwright.BrowserTypeLaunchOptions{ + Headless: playwright.Bool(env.Fetch("HEADLESS", "true") == "true"), + SlowMo: playwright.Float(1000), + }) + require.NoError(t, err) + + defer browser.Close() + defer driver.Stop() + + callback(browser) + }) +} |
