lamdera/program-test/2.0.0

NOTE: the latest version is 4.0.0

A Lamdera package. It is not on package.elm-lang.org: the Lamdera compiler provides it, from static.lamdera.com, so lamdera install works and elm install does not.

Effect.Snapshot

Upload snapshots to Percy.io for visual regression testing. You'll need to create an account first in order to get an API key.

{ apiKey : PercyApiKey
, gitBranch : String
, gitTargetBranch : String
, snapshots : Nonempty (Snapshot msg)
, publicFiles : List PublicFile
}
-> Task Error Response

Upload snapshots to Percy.io for visual regression testing. You'll need to create an account first in order to get an API key.

import Effect.Snapshot exposing (PercyApiKey(..))
import List.Nonempty exposing (Nonempty(..))
import MyLogin


heroBannerBytes =
    ...


a =
    uploadSnapshots
        { apiKey = PercyApiKey "my api token"
        , gitBranch = "my-feature-branch"
        , gitTargetBranch = "main"
        , snapshots = Nonempty { name = "Login page", html = MyLogin.view } []
        , publicFiles = [ { filepath = "hero-banner.png", content = heroBannerBytes } ]
        }
= PercyApiKey String

An API key needed to upload snapshots to Percy.io. Create an account first in order to get an API key.

type alias Snapshot msg =
{ name : String
, body : List (Html msg)
, widths : Nonempty Int
, minimumHeight : Maybe Int
}

Name of the snapshot and the html to be placed inside the body tag. widths specify what widths you want the html to be rendered at. minimumHeight is the minimum height in pixels of the rendered html (it will be taller if the html doesn't fit). If you set minimumHeight to Nothing then it's always the default height of the rendered html.

type alias PublicFile =
{ filepath : String
, content : Bytes
}

Files in your public folder such as images/profile-image.png or favicon.ico.

type alias Response =
{ success : Bool }

Response from server after we upload snapshots.

type Error
= BadUrl String
| Timeout
| NetworkError
| BadStatus
{ statusCode : Int
, body : String
}
| BadBody String
| SnapshotNamesNotUnique

Possible errors when uploading snapshots.

errorToString : Error -> String

Convert the error into a human readable form.