Created
May 18, 2019 00:50
-
-
Save mfeineis/07f9f878dcffa6ba3db225d975be1d86 to your computer and use it in GitHub Desktop.
A quick sketch of how we could map the cypress.io API to something nice in Elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (main) | |
import Html | |
main = | |
Html.text "Hello, World!" | |
-- API | |
type Alias | |
= CurrentUser | |
e2e cy = | |
describe "The Home Page" | |
[ it "successfully loads" | |
[ visit "/posts/new" | |
, getInput "input.post-title" | |
|> typeIn "My first post" | |
, elementThatContains "Submit" |> click | |
, currentUrl | |
|> shouldContain "/posts/my-first-post" | |
, log "Almost there..." | |
, getNode "h1" | |
|> shouldContain "My First Post" | |
] | |
, it "displays form validation" | |
[ getInput "#first" |> clear | |
, getForm "form" |> submit | |
, getNode "#errors" | |
|> shouldContain "Fist name is required" | |
] | |
, it "can fetch from the API" | |
[ request "/posts/3" | |
|> its "body" | |
|> as_ CurrentUser | |
] | |
] | |
suite = | |
configure | |
{ baseUrl = "http://localhost:8080" | |
} | |
e2e | |
-- HELPER | |
describe label fn = | |
Debug.todo "Boom!" | |
it label fn = | |
Debug.todo "Boom!" | |
configure config tests = | |
Debug.todo "Boom!" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment