tests

package
v0.0.0-...-d4abff4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtectedLdapURL is the URL for the LDAP use case
	ProtectedLdapURL = "http://protected-ldap.example.com:9080/"
	// ProtectedOidcURL is the URL for the OIDC use case
	ProtectedOidcURL = "http://protected-oidc.example.com:9080/"
	// ProtectedOAuth2URL is the URL for the OAuth2 use case
	ProtectedOAuth2URL = "http://protected-oauth2.example.com:9080/"
	// UnprotectedURL is the URL for the unprotected app
	UnprotectedURL = "http://unprotected.example.com:9080/"

	// LogoutOidcURL is the URL used to log out the user
	LogoutOidcURL = "http://auth-oidc.example.com:9080/"
	// LogoutOAuht2URL is the URL used to log out the user
	LogoutOAuht2URL = "http://auth-oauth2.example.com:9080/"
)

Variables

This section is empty.

Functions

func GetWebDriverPort

func GetWebDriverPort() int

GetWebDriverPort returns the port to initialize the webdriver with.

func WithWebdriver

func WithWebdriver(fn func(webdriver ExtendedWebDriver) error) error

WithWebdriver run some actions against a webdriver.

Types

type ExtendedWebDriver

type ExtendedWebDriver struct {
	selenium.WebDriver
}

ExtendedWebDriver extend the standard WebDriver interface

func (*ExtendedWebDriver) ClickOnGrantAccess

func (ewd *ExtendedWebDriver) ClickOnGrantAccess(ctx context.Context, t *testing.T)

ClickOnGrantAccess click on the grant access button in the dex approval page

func (*ExtendedWebDriver) FillCredentials

func (ewd *ExtendedWebDriver) FillCredentials(ctx context.Context, t *testing.T, username, password string)

FillCredentials wait until the credential fields in the dex UI are located

func (*ExtendedWebDriver) Wait

func (ewd *ExtendedWebDriver) Wait(ctx context.Context, condition selenium.Condition) error

Wait for a condition to be fulfilled. Wait wait until condition holds true.

func (*ExtendedWebDriver) WaitElementLocated

func (ewd *ExtendedWebDriver) WaitElementLocated(ctx context.Context, t *testing.T, by, value string) selenium.WebElement

WaitElementLocated wait until an element is located

func (*ExtendedWebDriver) WaitElementLocatedByID

func (ewd *ExtendedWebDriver) WaitElementLocatedByID(ctx context.Context, t *testing.T, id string) selenium.WebElement

WaitElementLocatedByID wait an element is located by id.

func (*ExtendedWebDriver) WaitElementLocatedByTagName

func (ewd *ExtendedWebDriver) WaitElementLocatedByTagName(ctx context.Context, t *testing.T, tagName string) selenium.WebElement

WaitElementLocatedByTagName wait an element is located by tag name.

func (*ExtendedWebDriver) WaitElementsLocated

func (ewd *ExtendedWebDriver) WaitElementsLocated(ctx context.Context, t *testing.T, by, value string) []selenium.WebElement

WaitElementsLocated wait until multiple elements are located

func (*ExtendedWebDriver) WaitElementsLocatedByTagName

func (ewd *ExtendedWebDriver) WaitElementsLocatedByTagName(ctx context.Context, t *testing.T, tagName string) []selenium.WebElement

WaitElementsLocatedByTagName wait elements is located by tag name.

func (*ExtendedWebDriver) WaitUntilAuthenticatedWithOIDC

func (ewd *ExtendedWebDriver) WaitUntilAuthenticatedWithOIDC(ctx context.Context, t *testing.T, username, password string)

WaitUntilAuthenticatedWithOIDC wait until the authentication workflow has been executed. This assert goes from the redirection to dex up to the click on the button to grant access to the information

func (*ExtendedWebDriver) WaitUntilBodyContains

func (ewd *ExtendedWebDriver) WaitUntilBodyContains(ctx context.Context, t *testing.T, match string)

WaitUntilBodyContains wait until the body of the page contains match

func (*ExtendedWebDriver) WaitUntilDexCredentialsFieldsAreDetetected

func (ewd *ExtendedWebDriver) WaitUntilDexCredentialsFieldsAreDetetected(ctx context.Context, t *testing.T)

WaitUntilDexCredentialsFieldsAreDetetected wait until the credential fields in the dex UI are located

func (*ExtendedWebDriver) WaitUntilLoginErrorAppear

func (ewd *ExtendedWebDriver) WaitUntilLoginErrorAppear(ctx context.Context, t *testing.T)

WaitUntilLoginErrorAppear wait until the error message in dex appears.

func (*ExtendedWebDriver) WaitUntilRedirectedToDexApproval

func (ewd *ExtendedWebDriver) WaitUntilRedirectedToDexApproval(ctx context.Context, t *testing.T)

WaitUntilRedirectedToDexApproval wait until the client is redirected to dex approval page

func (*ExtendedWebDriver) WaitUntilRedirectedToDexLogin

func (ewd *ExtendedWebDriver) WaitUntilRedirectedToDexLogin(ctx context.Context, t *testing.T)

WaitUntilRedirectedToDexLogin wait until the client is redirected to dex login portal

func (*ExtendedWebDriver) WaitUntilURLIs

func (ewd *ExtendedWebDriver) WaitUntilURLIs(ctx context.Context, t *testing.T, url string)

WaitUntilURLIs wait until the URL in the browser bar is the expected one

func (*ExtendedWebDriver) WaitUntilURLStartsWith

func (ewd *ExtendedWebDriver) WaitUntilURLStartsWith(ctx context.Context, t *testing.T, prefix string)

WaitUntilURLStartsWith wait until the client is redirected to an url starting with a given prefix

type WebDriverSession

type WebDriverSession struct {
	WebDriver selenium.WebDriver
	// contains filtered or unexported fields
}

WebDriverSession binding a selenium service and a webdriver.

func StartWebDriver

func StartWebDriver() (*WebDriverSession, error)

StartWebDriver create a selenium session.

func StartWebDriverWithProxy

func StartWebDriverWithProxy(proxy string, port int) (*WebDriverSession, error)

StartWebDriverWithProxy create a selenium session.

func (*WebDriverSession) Stop

func (wds *WebDriverSession) Stop() error

Stop stop the selenium session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL