Documentation ¶
Index ¶
- Constants
- Variables
- func CheckProxy() error
- func NewRequestWithContext(ctx context.Context, method, url string, body io.Reader) (*http.Request, error)
- func NewRetryableClient(timeout time.Duration) *retryablehttp.Client
- func NewRetryableRequestWithContext(ctx context.Context, method, url string, body io.Reader) (*retryablehttp.Request, error)
- type APITester
- func (c *APITester) GetEventResult(ctx context.Context, hookID string, eventID string) (apitest.TestResult, error)
- func (c *APITester) GetHooks(ctx context.Context, projectID string) ([]apitest.Hook, error)
- func (c *APITester) GetProject(ctx context.Context, hookID string) (apitest.ProjectMeta, error)
- func (c *APITester) GetProjects(ctx context.Context) ([]apitest.ProjectMeta, error)
- func (c *APITester) GetTest(ctx context.Context, hookID string, testID string) (apitest.Test, error)
- func (c *APITester) RunAllAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, ...) (apitest.AsyncResponse, error)
- func (c *APITester) RunEphemeralAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, ...) (apitest.AsyncResponse, error)
- func (c *APITester) RunTagAsync(ctx context.Context, hookID string, testTag string, buildID string, ...) (apitest.AsyncResponse, error)
- func (c *APITester) RunTestAsync(ctx context.Context, hookID string, testID string, buildID string, ...) (apitest.AsyncResponse, error)
- type AppStore
- func (s *AppStore) Download(id string) (io.ReadCloser, int64, error)
- func (s *AppStore) DownloadURL(url string) (io.ReadCloser, int64, error)
- func (s *AppStore) List(opts storage.ListOptions) (storage.List, error)
- func (s *AppStore) UploadStream(filename, description string, reader io.Reader) (storage.Item, error)
- type Batch
- type Capabilities
- type DeviceQuery
- type FrameworkResponse
- type GitHub
- type ImageRunner
- func (c *ImageRunner) DownloadArtifacts(ctx context.Context, id string) (io.ReadCloser, error)
- func (c *ImageRunner) GetLogs(ctx context.Context, id string) (string, error)
- func (c *ImageRunner) GetStatus(ctx context.Context, id string) (imagerunner.Runner, error)
- func (c *ImageRunner) StopRun(ctx context.Context, runID string) error
- func (c *ImageRunner) TriggerRun(ctx context.Context, spec imagerunner.RunnerSpec) (imagerunner.Runner, error)
- type InsightsService
- func (c *InsightsService) GetHistory(ctx context.Context, user iam.User, launchOrder config.LaunchOrder) (insights.JobHistory, error)
- func (c *InsightsService) ListJobs(ctx context.Context, userID, jobSource string, queryOpts job.QueryOption) (job.List, error)
- func (c *InsightsService) PostTestRun(ctx context.Context, runs []insights.TestRun) error
- func (c *InsightsService) ReadJob(ctx context.Context, jobID string) (job.Job, error)
- type Item
- type JobResp
- type Links
- type ListJobResp
- type ListResponse
- type MatchingCaps
- type PublishedTest
- type RDCJob
- type RDCService
- func (c *RDCService) DownloadArtifact(jobID, suiteName string, realDevice bool) []string
- func (c *RDCService) GetDevices(ctx context.Context, OS string) ([]devices.Device, error)
- func (c *RDCService) GetJobAssetFileContent(ctx context.Context, jobID, fileName string, realDevice bool) ([]byte, error)
- func (c *RDCService) GetJobAssetFileNames(ctx context.Context, jobID string, realDevice bool) ([]string, error)
- func (c *RDCService) PollJob(ctx context.Context, id string, interval, timeout time.Duration, ...) (job.Job, error)
- func (c *RDCService) ReadJob(ctx context.Context, id string, realDevice bool) (job.Job, error)
- func (c *RDCService) StartJob(ctx context.Context, opts job.StartOptions) (jobID string, isRDC bool, err error)
- type RDCSessionRequest
- type Resto
- func (c *Resto) DownloadArtifact(jobID, suiteName string, realDevice bool) []string
- func (c *Resto) GetBuildID(ctx context.Context, jobID string, buildSource build.Source) (string, error)
- func (c *Resto) GetJobAssetFileContent(ctx context.Context, jobID, fileName string, realDevice bool) ([]byte, error)
- func (c *Resto) GetJobAssetFileNames(ctx context.Context, jobID string, realDevice bool) ([]string, error)
- func (c *Resto) GetVirtualDevices(ctx context.Context, kind string) ([]vmd.VirtualDevice, error)
- func (c *Resto) IsTunnelRunning(ctx context.Context, id, owner string, filter tunnels.Filter, ...) error
- func (c *Resto) PollJob(ctx context.Context, id string, interval, timeout time.Duration, ...) (job.Job, error)
- func (c *Resto) ReadJob(ctx context.Context, id string, realDevice bool) (job.Job, error)
- func (c *Resto) StopJob(ctx context.Context, jobID string, realDevice bool) (job.Job, error)
- type SauceOpts
- type SessionRequest
- type TestComposer
- func (c *TestComposer) Frameworks(ctx context.Context) ([]framework.Framework, error)
- func (c *TestComposer) GetSlackToken(ctx context.Context) (string, error)
- func (c *TestComposer) UploadAsset(jobID string, realDevice bool, fileName string, contentType string, ...) error
- func (c *TestComposer) Versions(ctx context.Context, frameworkName string) ([]framework.Metadata, error)
- type TokenResponse
- type UploadResponse
- type UserService
- type Webdriver
Constants ¶
const ( RDCSource = "rdc" VDCSource = "vdc" APISource = "api" )
const AutomaticRunMode = "automatic"
AutomaticRunMode indicates the job is automated
Variables ¶
var ( // ErrServerError is returned when the server was not able to correctly handle our request (status code >= 500). ErrServerError = errors.New(msg.InternalServerError) // ErrJobNotFound is returned when the requested job was not found. ErrJobNotFound = errors.New(msg.JobNotFound) // ErrAssetNotFound is returned when the requested asset was not found. ErrAssetNotFound = errors.New(msg.AssetNotFound) // ErrTunnelNotFound is returned when the requested tunnel was not found. ErrTunnelNotFound = errors.New(msg.TunnelNotFound) )
var DefaultGitHub = GitHub{ HTTPClient: &http.Client{ Timeout: 4 * time.Second, Transport: &http.Transport{Proxy: http.ProxyFromEnvironment}, }, URL: "https://api.github.com", }
DefaultGitHub is a preconfigured instance of GitHub.
var LaunchOptions = map[config.LaunchOrder]string{ config.LaunchOrderFailRate: "fail_rate", }
Functions ¶
func CheckProxy ¶ added in v0.134.0
func CheckProxy() error
CheckProxy checks that the HTTP_PROXY is valid if it exists.
func NewRequestWithContext ¶ added in v0.125.0
func NewRequestWithContext(ctx context.Context, method, url string, body io.Reader) (*http.Request, error)
NewRequestWithContext is a wrapper around http.NewRequestWithContext that modifies the request by adding additional headers.
func NewRetryableClient ¶ added in v0.126.0
NewRetryableClient returns a new pre-configured instance of retryablehttp.Client.
func NewRetryableRequestWithContext ¶ added in v0.126.0
func NewRetryableRequestWithContext(ctx context.Context, method, url string, body io.Reader) (*retryablehttp.Request, error)
NewRetryableRequestWithContext is a wrapper around retryablehttp.NewRequestWithContext that modifies the request by adding additional headers.
Types ¶
type APITester ¶ added in v0.124.1
APITester describes an interface to the api-testing rest endpoints.
func NewAPITester ¶ added in v0.124.1
NewAPITester a new instance of APITester.
func (*APITester) GetEventResult ¶ added in v0.124.1
func (*APITester) GetProject ¶ added in v0.124.1
GetProject returns Project metadata for a given hookID.
func (*APITester) GetProjects ¶ added in v0.124.1
GetProjects returns the list of Project available.
func (*APITester) RunAllAsync ¶ added in v0.124.1
func (c *APITester) RunAllAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, test apitest.TestRequest) (apitest.AsyncResponse, error)
RunAllAsync runs all the tests for the project described by hookID and returns without waiting for their results.
func (*APITester) RunEphemeralAsync ¶ added in v0.124.1
func (c *APITester) RunEphemeralAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, taskID string, test apitest.TestRequest) (apitest.AsyncResponse, error)
RunEphemeralAsync runs the tests for the project described by hookID and returns without waiting for their results.
func (*APITester) RunTagAsync ¶ added in v0.124.1
func (c *APITester) RunTagAsync(ctx context.Context, hookID string, testTag string, buildID string, tunnel config.Tunnel, test apitest.TestRequest) (apitest.AsyncResponse, error)
RunTagAsync runs all the tests for a testTag for a project described by hookID and returns without waiting for results.
func (*APITester) RunTestAsync ¶ added in v0.124.1
func (c *APITester) RunTestAsync(ctx context.Context, hookID string, testID string, buildID string, tunnel config.Tunnel, test apitest.TestRequest) (apitest.AsyncResponse, error)
RunTestAsync runs a single test described by testID for the project described by hookID and returns without waiting for results.
type AppStore ¶ added in v0.124.1
AppStore implements a remote file storage for storage.AppService. See https://wiki.saucelabs.com/display/DOCS/Application+Storage for more details.
func NewAppStore ¶ added in v0.124.1
NewAppStore returns an implementation for AppStore
func (*AppStore) Download ¶ added in v0.124.1
Download downloads a file with the given id. It's the caller's responsibility to close the reader.
func (*AppStore) DownloadURL ¶ added in v0.124.1
DownloadURL downloads a file from the url. It's the caller's responsibility to close the reader.
type Batch ¶ added in v0.124.1
type Batch struct { Framework string `json:"framework,omitempty"` FrameworkVersion string `json:"frameworkVersion,omitempty"` RunnerVersion string `json:"runnerVersion,omitempty"` TestFile string `json:"testFile,omitempty"` Args []map[string]string `json:"args"` VideoFPS int `json:"video_fps"` }
Batch represents capabilities for batch frameworks.
type Capabilities ¶ added in v0.124.1
type Capabilities struct {
AlwaysMatch MatchingCaps `json:"alwaysMatch,omitempty"`
}
Capabilities represents the webdriver capabilities. https://www.w3.org/TR/webdriver/
type DeviceQuery ¶ added in v0.124.1
type DeviceQuery struct { Type string `json:"type"` DeviceDescriptorID string `json:"device_descriptor_id,omitempty"` PrivateDevicesOnly bool `json:"private_devices_only,omitempty"` CarrierConnectivityRequested bool `json:"carrier_connectivity_requested,omitempty"` RequestedDeviceType string `json:"requested_device_type,omitempty"` DeviceName string `json:"device_name,omitempty"` PlatformVersion string `json:"platform_version,omitempty"` }
DeviceQuery represents the device selection query for RDC.
type FrameworkResponse ¶ added in v0.124.1
type FrameworkResponse struct { Name string `json:"name"` Version string `json:"version"` EOLDate time.Time `json:"eolDate"` RemovalDate time.Time `json:"removalDate"` Runner runner `json:"runner"` Platforms []struct { Name string Browsers []string } `json:"platforms"` BrowserDefaults map[string]string `json:"browserDefaults"` }
FrameworkResponse represents the response body for framework information.
type ImageRunner ¶
type ImageRunner struct { Client *retryablehttp.Client URL string Creds iam.Credentials }
func NewImageRunner ¶
func NewImageRunner(url string, creds iam.Credentials, timeout time.Duration) ImageRunner
func (*ImageRunner) DownloadArtifacts ¶ added in v0.131.0
func (c *ImageRunner) DownloadArtifacts(ctx context.Context, id string) (io.ReadCloser, error)
func (*ImageRunner) GetStatus ¶
func (c *ImageRunner) GetStatus(ctx context.Context, id string) (imagerunner.Runner, error)
func (*ImageRunner) StopRun ¶
func (c *ImageRunner) StopRun(ctx context.Context, runID string) error
func (*ImageRunner) TriggerRun ¶
func (c *ImageRunner) TriggerRun(ctx context.Context, spec imagerunner.RunnerSpec) (imagerunner.Runner, error)
type InsightsService ¶ added in v0.124.1
type InsightsService struct { HTTPClient *http.Client URL string Credentials iam.Credentials }
func NewInsightsService ¶ added in v0.124.1
func NewInsightsService(url string, creds iam.Credentials, timeout time.Duration) InsightsService
func (*InsightsService) GetHistory ¶ added in v0.124.1
func (c *InsightsService) GetHistory(ctx context.Context, user iam.User, launchOrder config.LaunchOrder) (insights.JobHistory, error)
GetHistory returns job history from insights
func (*InsightsService) ListJobs ¶ added in v0.124.1
func (c *InsightsService) ListJobs(ctx context.Context, userID, jobSource string, queryOpts job.QueryOption) (job.List, error)
ListJobs returns job list
func (*InsightsService) PostTestRun ¶ added in v0.124.1
PostTestRun publish test-run results to insights API.
type Item ¶ added in v0.124.1
type Item struct { ID string `json:"id"` Name string `json:"name"` Size int `json:"size"` UploadTimestamp int64 `json:"upload_timestamp"` }
Item represents the metadata about the uploaded file.
type JobResp ¶ added in v0.124.1
type JobResp struct { ID string `json:"id"` Name string `json:"name"` Status string `json:"status"` Error string `json:"error"` Framework string `json:"automation_backend"` Device string `json:"device"` BrowserName string `json:"browser_name"` OS string `json:"os"` OSVersion string `json:"os_version"` Source string `json:"source"` }
JobResp represents job response structure
type Links ¶ added in v0.124.1
Links represents the pagination information returned by the app store.
type ListJobResp ¶ added in v0.124.1
ListJobResp represents list job response structure
type ListResponse ¶ added in v0.124.1
type ListResponse struct { Items []Item `json:"items"` Links Links `json:"links"` Page int `json:"page"` PerPage int `json:"per_page"` TotalItems int `json:"total_items"` }
ListResponse represents the response as is returned by the app store.
type MatchingCaps ¶ added in v0.124.1
type MatchingCaps struct { App string `json:"app,omitempty"` OtherApps []string `json:"otherApps,omitempty"` BrowserName string `json:"browserName,omitempty"` BrowserVersion string `json:"browserVersion,omitempty"` PlatformName string `json:"platformName,omitempty"` SauceOptions SauceOpts `json:"sauce:options,omitempty"` PlatformVersion string `json:"platformVersion,omitempty"` DeviceName string `json:"deviceName,omitempty"` DeviceOrientation string `json:"deviceOrientation,omitempty"` }
MatchingCaps are specific attributes that together form the capabilities that are used to match a session.
type PublishedTest ¶ added in v0.124.1
PublishedTest describes a published test.
type RDCJob ¶ added in v0.124.1
type RDCJob struct { ID string AutomationBackend string `json:"automation_backend,omitempty"` FrameworkLogURL string `json:"framework_log_url,omitempty"` DeviceLogURL string `json:"device_log_url,omitempty"` TestCasesURL string `json:"test_cases_url,omitempty"` VideoURL string `json:"video_url,omitempty"` Screenshots []struct { ID string } `json:"screenshots,omitempty"` Status string `json:"status,omitempty"` Passed bool ConsolidatedStatus string `json:"consolidated_status,omitempty"` Error string `json:"error,omitempty"` }
type RDCService ¶ added in v0.124.1
type RDCService struct { Client *retryablehttp.Client URL string Username string AccessKey string ArtifactConfig config.ArtifactDownload }
RDCService http client.
func NewRDCService ¶ added in v0.124.1
func NewRDCService(url, username, accessKey string, timeout time.Duration, artifactConfig config.ArtifactDownload) RDCService
NewRDCService creates a new client.
func (*RDCService) DownloadArtifact ¶ added in v0.124.1
func (c *RDCService) DownloadArtifact(jobID, suiteName string, realDevice bool) []string
DownloadArtifact downloads artifacts and returns a list of downloaded files.
func (*RDCService) GetDevices ¶ added in v0.124.1
GetDevices returns the list of available devices using a specific operating system.
func (*RDCService) GetJobAssetFileContent ¶ added in v0.124.1
func (c *RDCService) GetJobAssetFileContent(ctx context.Context, jobID, fileName string, realDevice bool) ([]byte, error)
GetJobAssetFileContent returns the job asset file content.
func (*RDCService) GetJobAssetFileNames ¶ added in v0.124.1
func (c *RDCService) GetJobAssetFileNames(ctx context.Context, jobID string, realDevice bool) ([]string, error)
GetJobAssetFileNames returns all assets files available.
func (*RDCService) PollJob ¶ added in v0.124.1
func (c *RDCService) PollJob(ctx context.Context, id string, interval, timeout time.Duration, realDevice bool) (job.Job, error)
PollJob polls job details at an interval, until timeout has been reached or until the job has ended, whether successfully or due to an error.
func (*RDCService) StartJob ¶ added in v0.124.1
func (c *RDCService) StartJob(ctx context.Context, opts job.StartOptions) (jobID string, isRDC bool, err error)
StartJob creates a new job in Sauce Labs.
type RDCSessionRequest ¶ added in v0.124.1
type RDCSessionRequest struct { TestFramework string `json:"test_framework,omitempty"` AppID string `json:"app_id,omitempty"` TestAppID string `json:"test_app_id,omitempty"` OtherApps []string `json:"other_apps,omitempty"` DeviceQuery DeviceQuery `json:"device_query,omitempty"` TestOptions map[string]string `json:"test_options,omitempty"` TestsToRun []string `json:"tests_to_run,omitempty"` TestsToSkip []string `json:"tests_to_skip,omitempty"` TestName string `json:"test_name,omitempty"` TunnelName string `json:"tunnel_name,omitempty"` TunnelOwner string `json:"tunnel_owner,omitempty"` UseTestOrchestrator bool `json:"use_test_orchestrator,omitempty"` Tags []string `json:"tags,omitempty"` Build string `json:"build,omitempty"` AppSettings job.AppSettings `json:"settings,omitempty"` RealDeviceKind string `json:"kind,omitempty"` }
RDCSessionRequest represents the RDC session request.
type Resto ¶ added in v0.124.1
type Resto struct { Client *retryablehttp.Client URL string Username string AccessKey string ArtifactConfig config.ArtifactDownload }
Resto http client.
func (*Resto) DownloadArtifact ¶ added in v0.124.1
DownloadArtifact downloads artifacts and returns a list of what was downloaded.
func (*Resto) GetBuildID ¶ added in v0.124.1
func (*Resto) GetJobAssetFileContent ¶ added in v0.124.1
func (c *Resto) GetJobAssetFileContent(ctx context.Context, jobID, fileName string, realDevice bool) ([]byte, error)
GetJobAssetFileContent returns the job asset file content.
func (*Resto) GetJobAssetFileNames ¶ added in v0.124.1
func (c *Resto) GetJobAssetFileNames(ctx context.Context, jobID string, realDevice bool) ([]string, error)
GetJobAssetFileNames return the job assets list.
func (*Resto) GetVirtualDevices ¶ added in v0.124.1
GetVirtualDevices returns the list of available virtual devices.
func (*Resto) IsTunnelRunning ¶ added in v0.124.1
func (c *Resto) IsTunnelRunning(ctx context.Context, id, owner string, filter tunnels.Filter, wait time.Duration) error
IsTunnelRunning checks whether tunnelID is running. If not, it will wait for the tunnel to become available or timeout. Whichever comes first.
func (*Resto) PollJob ¶ added in v0.124.1
func (c *Resto) PollJob(ctx context.Context, id string, interval, timeout time.Duration, realDevice bool) (job.Job, error)
PollJob polls job details at an interval, until timeout has been reached or until the job has ended, whether successfully or due to an error.
type SauceOpts ¶ added in v0.124.1
type SauceOpts struct { DevX bool `json:"devX,omitempty"` TestName string `json:"name,omitempty"` Tags []string `json:"tags,omitempty"` BuildName string `json:"build,omitempty"` Batch Batch `json:"_batch,omitempty"` IdleTimeout int `json:"idleTimeout,omitempty"` MaxDuration int `json:"maxDuration,omitempty"` TunnelIdentifier string `json:"tunnelIdentifier,omitempty"` TunnelParent string `json:"parentTunnel,omitempty"` // note that 'parentTunnel` is backwards, because that's the way sauce likes it ScreenResolution string `json:"screen_resolution,omitempty"` SauceCloudNode string `json:"_sauceCloudNode,omitempty"` UserAgent string `json:"user_agent,omitempty"` TimeZone string `json:"timeZone,omitempty"` Visibility string `json:"public,omitempty"` }
SauceOpts represents the Sauce Labs specific capabilities.
type SessionRequest ¶ added in v0.124.1
type SessionRequest struct { Capabilities Capabilities `json:"capabilities,omitempty"` DesiredCapabilities MatchingCaps `json:"desiredCapabilities,omitempty"` }
SessionRequest represents the webdriver session request.
type TestComposer ¶ added in v0.124.1
type TestComposer struct { HTTPClient *http.Client URL string // e.g.) https://api.<region>.saucelabs.net Credentials iam.Credentials }
TestComposer service
func NewTestComposer ¶ added in v0.124.1
func NewTestComposer(url string, creds iam.Credentials, timeout time.Duration) TestComposer
func (*TestComposer) Frameworks ¶ added in v0.124.1
Frameworks returns the list of available frameworks.
func (*TestComposer) GetSlackToken ¶ added in v0.124.1
func (c *TestComposer) GetSlackToken(ctx context.Context) (string, error)
GetSlackToken gets slack token.
func (*TestComposer) UploadAsset ¶ added in v0.124.1
func (c *TestComposer) UploadAsset(jobID string, realDevice bool, fileName string, contentType string, content []byte) error
UploadAsset uploads an asset to the specified jobID.
type TokenResponse ¶ added in v0.124.1
type TokenResponse struct {
Token string `json:"token"`
}
TokenResponse represents the response body for slack token.
type UploadResponse ¶ added in v0.124.1
type UploadResponse struct {
Item Item `json:"item"`
}
UploadResponse represents the response as is returned by the app store.
type UserService ¶ added in v0.124.1
type UserService struct { HTTPClient *http.Client URL string Credentials iam.Credentials }
func NewUserService ¶ added in v0.124.1
func NewUserService(url string, creds iam.Credentials, timeout time.Duration) UserService
func (*UserService) Concurrency ¶ added in v0.126.0
func (c *UserService) Concurrency(ctx context.Context) (iam.Concurrency, error)
Concurrency returns the concurrency settings for the current account.
type Webdriver ¶ added in v0.124.1
type Webdriver struct { HTTPClient *http.Client URL string Credentials iam.Credentials }
Webdriver service