Documentation ¶
Index ¶
- Constants
- type Base
- type CheckFunc
- type Config
- func (c Config) Add(name string, s Szenario, ut []*UserType) Szenario
- func (c Config) ByName(name string) Szenario
- func (c Config) ByUser(u User) ([]Szenario, error)
- func (c Config) CreateUserType(n string, desc string) (*UserType, error)
- func (c Config) GetUserType(name string) *UserType
- func (c Config) GetUserTypes() []string
- func (c Config) SzenarioCount() int
- type EitherOption
- type Engine
- type JobFunc
- type Szenario
- type TimeoutError
- type User
- type UserType
Constants ¶
View Source
const (
// UserTypeAll name of the usertype that contains all szenarios
UserTypeAll = "all"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct { CheckRepeat time.Duration CheckTimeout time.Duration LoginRetry int // contains filtered or unexported fields }
Base is the base type of all szenarios
func (Base) GetMaxLoginTry ¶ added in v0.12.2
GetMaxLoginTry returns how many times a login with a new password should be attemped
func (Base) RepeatDelay ¶ added in v0.12.0
RepeatDelay between executions
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds all Szenario informations
func (Config) ByName ¶
ByName return the szario by name, names are case insensitive and if no exact match is found a prefix match is done
func (Config) CreateUserType ¶
CreateUserType creates a user type
func (Config) GetUserType ¶
GetUserType returns the usertype
func (Config) GetUserTypes ¶
GetUserTypes returns a list of all user types
func (Config) SzenarioCount ¶
SzenarioCount returns the number of szenarios
type EitherOption ¶ added in v0.11.0
type Engine ¶
type Engine interface { // StepTimeout executes a Step with an timeout StepTimeout(name string, timeout time.Duration, actions ...chromedp.Action) error // Step executes the actions given and records how long it takes Step(name string, actions ...chromedp.Action) // SetInputField sets a HTML input field and validates that it has been set SetInputField(stepName string, sel interface{}, value string, opts ...func(*chromedp.Selector)) error // IsPresent checks if something is present IsPresent(sel interface{}, opts ...chromedp.QueryOption) bool // Either wait for a list of options and sends the name of the first met option to the channel Either(name string, option ...EitherOption) <-chan any // Body is used to check the content of the page Body(checks ...CheckFunc) chromedp.Action // IsHeadless indicates if the browser is headless (i.e. does not show on screen) IsHeadless() bool // Dump prints the body and its size to log Dump() CheckFunc // Contains looks for a string in the body Contains(s string) CheckFunc // NotContains looks for a string in the body and errs if found NotContains(s string) CheckFunc // Bigger checks if the size of the body (in bytes) in bigger than i Bigger(i int) CheckFunc // Strings gets the body as plaintext Strings(html *string) CheckFunc // SetStatus sets a status of the event SetStatus(key, val string) // AddErr adds a error to the event AddErr(err error) // Log returns the logger Log() *slog.Logger // WaitForEver blocks until the timeout is reached WaitForEver() // BreakWaitForUserInput waits until any key is clicked on the cmdlint BreakWaitForUserInput() }
Engine is executing a szenario
type Szenario ¶
type Szenario interface { Name() string // Name returns the name User() User // User returns the user the szenario runs with SetUser(u User) // SetUser set the user the szenario runs with Execute(Engine) error // Execute the szenario RepeatDelay() time.Duration // RepeatDelay between executions Timeout() time.Duration // Timeout for an execution GetMaxLoginTry() int // GetMaxLoginTry returns how many times a login with a new password should be attemped }
Szenario is the definition of a monitoring szenario
type TimeoutError ¶ added in v0.10.3
TimeoutError indicated a timeout
type User ¶
type User interface { // Name returns the name Name() string // Email returns the email address Email() string // DisplayName returns the display name DisplayName() string // Type returns what kind of user it is Type() string // Password decrypts the password Password() string // NextPassword increases the password index and returns the decrypted PW // retruns empty string "" if no more passwords are present NextPassword() string // LoginSuccessfull sets the last use of the password LoginSuccessfull() // NewPassword generates a new password // it does not store the password NewPassword() (string, error) // PasswordHistoryCount returns the number of PW in the history PasswordHistoryCount() int // PasswordCreated returns the time when the password was created PasswordCreated() time.Time // PasswordLastUse returns the time when the password was last accessed PasswordLastUse() time.Time // NumPasswdChg number of times the password was changed NumPasswdChg(time.Duration) int // ResetPasswordIndex start with the first password // and reset the number of failed logins to 0 ResetPasswordIndex() // FailedLogins the number of failed logins FailedLogins() int // SetPassword encrypts the password SetPassword(pw string) // String implements stringer String() string // IsValid checks if all needed fields are set IsValid() error // Save the user to the store Save() error }
User stores a user and its encrypted password
Click to show internal directories.
Click to hide internal directories.