Documentation ¶
Overview ¶
Package browsertest provides integration test helpers for our browser-based tests.
Index ¶
- func LoginToUpstreamGitHub(t *testing.T, b *Browser, upstream testlib.TestGithubUpstream)
- func LoginToUpstreamLDAP(t *testing.T, b *Browser, issuer, username, password string)
- func LoginToUpstreamOIDC(t *testing.T, b *Browser, upstream testlib.TestOIDCUpstream)
- func SubmitUpstreamLDAPLoginForm(t *testing.T, b *Browser, username string, password string)
- func WaitForUpstreamLDAPLoginPageWithError(t *testing.T, b *Browser, issuer string)
- type Browser
- func (b *Browser) AttrValueOfFirstMatch(t *testing.T, cssSelector string, attributeName string) string
- func (b *Browser) ClickFirstMatch(t *testing.T, cssSelector string) string
- func (b *Browser) FindConsoleEventWithTextMatching(consoleEventAPIType string, re *regexp.Regexp) (string, bool)
- func (b *Browser) Navigate(t *testing.T, url string)
- func (b *Browser) SendKeysToFirstMatch(t *testing.T, cssSelector string, runesToType string)
- func (b *Browser) TextOfFirstMatch(t *testing.T, cssSelector string) string
- func (b *Browser) Title(t *testing.T) string
- func (b *Browser) WaitForURL(t *testing.T, regex *regexp.Regexp)
- func (b *Browser) WaitForVisibleElements(t *testing.T, cssSelectors ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoginToUpstreamGitHub ¶ added in v0.31.0
func LoginToUpstreamGitHub(t *testing.T, b *Browser, upstream testlib.TestGithubUpstream)
LoginToUpstreamGitHub expects the page to be redirected to GitHub. It knows how to enter the test username/password and submit the upstream login form.
func LoginToUpstreamLDAP ¶ added in v0.18.0
LoginToUpstreamLDAP expects the page to be redirected to the Supervisor's login UI for an LDAP/AD IDP. It knows how to enter the test username/password and submit the upstream login form.
func LoginToUpstreamOIDC ¶ added in v0.18.0
func LoginToUpstreamOIDC(t *testing.T, b *Browser, upstream testlib.TestOIDCUpstream)
LoginToUpstreamOIDC expects the page to be redirected to one of several known upstream IDPs. It knows how to enter the test username/password and submit the upstream login form.
func SubmitUpstreamLDAPLoginForm ¶ added in v0.18.0
Types ¶
type Browser ¶ added in v0.25.0
type Browser struct {
// contains filtered or unexported fields
}
Browser abstracts the specific browser driver library that we use and provides an interface for integration tests to interact with the browser.
func OpenBrowser ¶ added in v0.25.0
OpenBrowser opens a web browser as a subprocess and returns a Browser which allows further interactions with the browser. The subprocess will be cleaned up at the end of the test. Each call to OpenBrowser creates a new browser which does not share any cookies with other browsers from other calls.
func (*Browser) AttrValueOfFirstMatch ¶ added in v0.25.0
func (*Browser) ClickFirstMatch ¶ added in v0.25.0
func (*Browser) FindConsoleEventWithTextMatching ¶ added in v0.25.0
func (b *Browser) FindConsoleEventWithTextMatching(consoleEventAPIType string, re *regexp.Regexp) (string, bool)
FindConsoleEventWithTextMatching searches the browser's console that have been observed so far to find an event with an argument (converted to a string) that matches the provided regexp. consoleEventAPIType could be any of the console.funcName() names, e.g. "log", "info", "error", etc. It returns the first matching event argument value. It doesn't worry about optimizing the search speed because there should not be too many console events and because this just is a test helper.
func (*Browser) SendKeysToFirstMatch ¶ added in v0.25.0
func (*Browser) TextOfFirstMatch ¶ added in v0.25.0
func (*Browser) WaitForURL ¶ added in v0.25.0
WaitForURL expects the page to eventually navigate to a URL matching the specified pattern. It waits for this to occur and times out, failing the test, if it never does.