{"_id":"t-elm-spec","_rev":"5-5e7f48d7456f1b3eb4ba3edb2ac08497","name":"t-elm-spec","description":"Integration testing in Elm.","dist-tags":{"latest":"1.1.5"},"versions":{"1.1.1":{"name":"t-elm-spec","version":"1.1.1","description":"Integration testing in Elm.","repository":{"type":"git","url":"git+https://github.com/takaczapka/elm-spec.git"},"homepage":"https://github.com/takaczapka/elm-spec#readme","author":"","license":"BSD-2-Clause","bugs":{"url":"https://github.com/takaczapka/elm-spec/issues"},"scripts":{"spec":"node bin/elm-spec.js","start":"elm-reactor -p 8002"},"dependencies":{"async":"^2.1.4","camelcase":"^4.0.0","colors":"^1.1.2","cssstyle":"^0.2.37","elm":"^0.18.0","elm-github-install":"^1.0.1","globby":"^6.1.0","indent-string":"^3.0.0","jsdom":"^9.9.1","node-localstorage":"^1.3.0","npm-which":"^3.0.1","pad":"^1.0.2","temp":"^0.8.3","yargs":"^6.6.0"},"preferGlobal":true,"bin":{"t-elm-spec":"bin/elm-spec.js"},"devDependencies":{"standard":"^8.6.0"},"standard":{"ignore":["source/Native/HttpMock.js"]},"gitHead":"099d583cc880e3b7bee03662f0eb7205388933ee","_id":"t-elm-spec@1.1.1","_shasum":"d74ca25d6b7a5377bc7c09f7f18e98bc8c8909ce","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"takaczapka","email":"takaczapka@gmail.com"},"dist":{"shasum":"d74ca25d6b7a5377bc7c09f7f18e98bc8c8909ce","tarball":"https://registry.npmjs.org/t-elm-spec/-/t-elm-spec-1.1.1.tgz","integrity":"sha512-ajwMMyd2FYbd8Lo6NrCCtDNOgsgmloMDrk4yyaCr4Qjd72yKtXMeX6nN1S3Bn9kHCcIZLCIRKufwQfjbKDKwtQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCkP43ekpF2EyRw2m81dwdANjY9Kgx+fMJX3cSDWiWuWAIhAL3ZBjdBD5j4hj3Q/kZply7Kq5bcie8DC8gISeelC2Ce"}]},"maintainers":[{"name":"takaczapka","email":"takaczapka@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/t-elm-spec-1.1.1.tgz_1497277334599_0.9392978202085942"}},"1.1.3":{"name":"t-elm-spec","version":"1.1.3","description":"Integration testing in Elm.","repository":{"type":"git","url":"git+https://github.com/takaczapka/elm-spec.git"},"homepage":"https://github.com/takaczapka/elm-spec#readme","author":"","license":"BSD-2-Clause","bugs":{"url":"https://github.com/takaczapka/elm-spec/issues"},"scripts":{"spec":"node bin/elm-spec.js","start":"elm-reactor -p 8002"},"dependencies":{"async":"^2.1.4","camelcase":"^4.0.0","colors":"^1.1.2","cssstyle":"^0.2.37","elm":"^0.18.0","elm-github-install":"^1.0.1","globby":"^6.1.0","indent-string":"^3.0.0","jsdom":"^9.9.1","node-localstorage":"^1.3.0","npm-which":"^3.0.1","pad":"^1.0.2","temp":"^0.8.3","yargs":"^6.6.0"},"preferGlobal":true,"bin":{"t-elm-spec":"bin/elm-spec.js"},"devDependencies":{"standard":"^8.6.0"},"standard":{"ignore":["source/Native/HttpMock.js"]},"gitHead":"d1ac5f72520e506d838e81900068d58123116b10","_id":"t-elm-spec@1.1.3","_shasum":"937bf56144f18dd14c7446777d1509876bc372c4","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"takaczapka","email":"takaczapka@gmail.com"},"dist":{"shasum":"937bf56144f18dd14c7446777d1509876bc372c4","tarball":"https://registry.npmjs.org/t-elm-spec/-/t-elm-spec-1.1.3.tgz","integrity":"sha512-NkVFaLe8V9GZJYswV+R7JD/Efs+r1YkamNxoEwMKeoFeAO57A0n+DXwBTTXgsMca1luhE4pN4a8bAYbNYY41xA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDY4Ggi73RZh6/Dwl+XKSGYgzGljT/50H+SCiw0TE0LyQIhAPzgIcW6R++0TTbOSjFKYzcejNnv/ZbbhRmhbgYesroi"}]},"maintainers":[{"name":"takaczapka","email":"takaczapka@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/t-elm-spec-1.1.3.tgz_1499442013780_0.524014042224735"}},"1.1.4":{"name":"t-elm-spec","version":"1.1.4","description":"Integration testing in Elm.","repository":{"type":"git","url":"git+https://github.com/takaczapka/elm-spec.git"},"homepage":"https://github.com/takaczapka/elm-spec#readme","author":"","license":"BSD-2-Clause","bugs":{"url":"https://github.com/takaczapka/elm-spec/issues"},"scripts":{"spec":"node bin/elm-spec.js","start":"elm-reactor -p 8002"},"dependencies":{"async":"^2.1.4","camelcase":"^4.0.0","colors":"^1.1.2","cssstyle":"^0.2.37","elm":"^0.18.0","elm-github-install":"^1.0.1","globby":"^6.1.0","indent-string":"^3.0.0","jsdom":"^9.9.1","node-localstorage":"^1.3.0","npm-which":"^3.0.1","pad":"^1.0.2","temp":"^0.8.3","yargs":"^6.6.0"},"preferGlobal":true,"bin":{"t-elm-spec":"bin/elm-spec.js"},"devDependencies":{"standard":"^8.6.0"},"standard":{"ignore":["source/Native/HttpMock.js"]},"gitHead":"845c2102e79ef1baf654038133f2d8c3ae092d65","_id":"t-elm-spec@1.1.4","_shasum":"5dae4d81aea9e8f5c090d7b487a5bf5b90e1355f","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"takaczapka","email":"takaczapka@gmail.com"},"dist":{"shasum":"5dae4d81aea9e8f5c090d7b487a5bf5b90e1355f","tarball":"https://registry.npmjs.org/t-elm-spec/-/t-elm-spec-1.1.4.tgz","integrity":"sha512-QT6Jnqi9qh7DMjb5Jn8kD4L04bqyyVygtuR646nEfXO+zz2FDvX7upmygKetPcXXdZAjBWXcFU5PP3Wz9bhwjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTqeJWeQz22eSnMoaUUhvOI6Y2D/9V0ICKwjBQvrjjTAIhANnTbQSzITP10ibzHzySJrySqnMN0atJdyclAvZosgTw"}]},"maintainers":[{"name":"takaczapka","email":"takaczapka@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/t-elm-spec-1.1.4.tgz_1500028172547_0.5686337596271187"}},"1.1.5":{"name":"t-elm-spec","version":"1.1.5","description":"Integration testing in Elm.","repository":{"type":"git","url":"git+https://github.com/takaczapka/elm-spec.git"},"homepage":"https://github.com/takaczapka/elm-spec#readme","author":"","license":"BSD-2-Clause","bugs":{"url":"https://github.com/takaczapka/elm-spec/issues"},"scripts":{"spec":"node bin/elm-spec.js","start":"elm-reactor -p 8002"},"dependencies":{"async":"^2.1.4","camelcase":"^4.0.0","colors":"^1.1.2","cssstyle":"^0.2.37","elm":"^0.18.0","elm-github-install":"^1.0.1","globby":"^6.1.0","indent-string":"^3.0.0","jsdom":"^9.9.1","node-localstorage":"^1.3.0","npm-which":"^3.0.1","pad":"^1.0.2","temp":"^0.8.3","yargs":"^6.6.0"},"preferGlobal":true,"bin":{"t-elm-spec":"bin/elm-spec.js"},"devDependencies":{"standard":"^8.6.0"},"standard":{"ignore":["source/Native/HttpMock.js"]},"gitHead":"8b321e291e1c87b2ad8fc5ef3dfeb66bb89ff45f","_id":"t-elm-spec@1.1.5","_shasum":"e88952c672df08da2749293cb727ddd22180b8d7","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.0","_npmUser":{"name":"takaczapka","email":"takaczapka@gmail.com"},"dist":{"shasum":"e88952c672df08da2749293cb727ddd22180b8d7","tarball":"https://registry.npmjs.org/t-elm-spec/-/t-elm-spec-1.1.5.tgz","integrity":"sha512-8PR48cAGbSYwjcrnDgrA0yPzmO86JJIl56JARavdj3QfA9iQaQ5oLTf6x49SCgksP69BB0T6/X0/t7xpXMLltA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrl5sMYqKN5/MyZOamHLqck4/069A22shdThWQyouyCwIgLSapUY3OiyPg0AMZr9IqY2ZqRHVGyB/jM7NE8AsLINc="}]},"maintainers":[{"name":"takaczapka","email":"takaczapka@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/t-elm-spec-1.1.5.tgz_1500040457153_0.36076038773171604"}}},"readme":"# elm-spec\n[![Build Status](https://travis-ci.org/gdotdesign/elm-spec.svg?branch=master)](https://travis-ci.org/gdotdesign/elm-spec)\n[![npm version](https://badge.fury.io/js/elm-spec.svg)](https://badge.fury.io/js/elm-spec)\n\nEnd-to-end testing for your Elm apps and components.\n\n## Features\n* Can test apps or separate components\n* `Task` based steps and assertions (allows createing custom ones easily)\n* Create composite steps from other steps\n* DOM steps and assertions (`click`, `containsText`, `valueEquals`, etc...)\n* Mock HTTP requests and report not mocked requests\n* `before` / `after` hooks\n* Run tests in the console (via _jsdom_)\n* Run tests with `elm-reactor` with HTML Report\n* Run files one at a time `elm-spec spec/SomeSpec.elm`\n* Run tests one at a time `elm-spec spec/SomeSpec.elm:2`\n\n## CLI\nYou can install the CLI with either of the following commands:\n\n`npm install elm-spec -g` or `yarn global add elm-spec`\n\n```\nelm-spec [glob pattern or file:testID] -f format\n\nOptions:\n  --format, -f  Reporting format\n               [choices: \"documentation\", \"progress\"] [default: \"documentation\"]\n  --help        Show help                                              [boolean]\n\n```\n\n## Adding the package\nAdd `gdotdesign/elm-spec` as a dependency to your `elm-package.json`.\n\n```json\n  \"dependencies\": {\n    \"gdotdesign/elm-spec\": \"1.0.0 <= v 2.0.0\"\n  }\n```\n\nAnd then install with [elm-github-install](https://github.com/gdotdesign/elm-github-install) using the `elm-install` command.\n\n## Quick Start\nHere is an exmaple of testing a simple component:\n\n```elm\nimport Spec exposing (..)\n\nimport Html.Events exposing (onClick)\nimport Html exposing (div, text)\n\ntype alias Model\n  = String\n\ntype Msg\n  = Set\n\ninit : () -> Model\ninit _ =\n  \"Empty\"\n\nupdate : Msg -> Model -> ( Model, Cmd Msg )\nupdate msg model =\n  case msg of\n    Set ->\n      ( \"Something\", Cmd.none )\n\nview : Model -> Html.Html Msg\nview model =\n  div [ onClick Set ] [ text model ]\n\nspecs : Node msg\nspecs =\n  describe \"Example\"\n    [ it \"clicking on the div should change the text\"\n      [ assert.containsText { text = \"Empty\", selector = \"div\" }\n      , steps.click \"div\"\n      , assert.containsText { text = \"Something\", selector = \"div\" }\n      ]\n    ]\n\nmain =\n  runWithProgram\n    { subscriptions = \\_ -> Sub.none\n    , update = update\n    , view = view\n    , init = init\n    , initCmd = Cmd.none\n    } specs\n```\n\nAnd open the file in `elm-reactor` or run it wit the `elm-spec` command:\n\n```\n$ elm-spec spec/ExampleSpec.elm\n◎ spec/ExampleSpec.elm\n  Example\n    ✔ clicking on the div should change the text\n      Element div contains text \"Empty\"\n      Clicked: div\n      Element div contains text \"Something\"\n\n1 files 1 tests:\n 3 steps: 3 successfull, 0 failed, 0 errored\n 0 requests: 0 called, 0 not called, 0 unhandled\n```\n\n## Defining tests\nYou can define tests with the `it` or `test` functions:\n\n```elm\nit \"does something\"\n  [ step1\n  , assertion1\n  , step2\n  , assertion2\n  ]\n```\n\nEach test can have an unlimited number of steps (`Task Never Outcome`) which\nare executed in sequence.\n\nBefore every test the given application is reset and a fresh DOM is created.\n\n## Defining Groups\nYou can define groups that can have an tests, hooks and groups. There are three\nfunctions that do the same thing: `group`, `context`, `describe`.\n\n```elm\ncontext \"Something\"\n  [ describe \"Something else\"\n    [ it \"does something\"\n      [ step1\n      , assertion1\n      ]\n    ]\n  ]\n```\n\n## Hooks\nElm-spec allows you to append and prepend steps and assertions before each test\nwith the `before` and `after` functions.\n\nThese functions can be defined in a group and it will add it's steps to each\ntest in that group and it's descendant groups tests (recursively).\n\n```elm\ncontext \"Something\"\n  [ describe \"Something else\"\n    [ before\n      [ preparationStep1\n      ]\n    , after\n      [ cleanupStep1\n      ]\n    , it \"does something\"\n      [ step1\n      , assertion1\n      ]\n    ]\n  ]\n```\n\n## Steps and Assertions\nThe following steps are available in the `steps` record:\n\n```elm\n{ dispatchEvent : String -> Json.Value -> String -> Step\n, getAttribute : String -> String -> Task Never String\n, setValue : String -> String -> Step\n, getTitle : Task Never String\n, clearValue : String -> Step\n, getUrl : Task Never String\n, click : String -> Step\n, inputViaPort : String -> Json.Value -> Step\n}\n```\n\nAnd the following assertions are available in the `assert` and `assert.not`\nrecords:\n\n```elm\n{ attributeContains : AttributeData -> Assertion\n, attributeEquals : AttributeData -> Assertion\n, inlineStyleEquals : StyleData -> Assertion\n, valueContains : TextData -> Assertion\n, classPresent : ClassData -> Assertion\n, containsText : TextData -> Assertion\n, styleEquals : StyleData -> Assertion\n, elementPresent : String -> Assertion\n, elementVisible : String -> Assertion\n, titleContains : String -> Assertion\n, valueEquals : TextData -> Assertion\n, titleEquals : String -> Assertion\n, urlContains : String -> Assertion\n, urlEquals : String -> Assertion\n}\n```\n\n## Step groups\nYou can define a new step that is composed of many other steps but appear as\none step in the results with the `stepGroup` function. If any of the defined\nsteps fails the new step fails as well.\n\n```elm\nmyStep =\n  stepGroup \"Descripiton of the step\"\n    [ step1\n    , assertion1\n    ]\n\nspec =\n  it \"does something\"\n    [ myStep\n    , step2\n    ]\n```\n\n## Interaction with Ports\nIf your application uses _Ports_ to input data from outside JavaScript\ncontext, you can simulate these events using `inputViaPort` step, i.e.:\n\n```elm\n  -- having defined ports module\n  ports module Ports exposing (..) \n  \n  port inputValue : (String -> msg) -> Sub msg\n  \n  -- and subscribing to it's values in the application's and test spec's main  \n  main =\n      runWithProgram -- for test spec's or Html.program for real app\n          { init = init\n          , update = update\n          , view = view\n          , subscriptions = \\_ -> Sub.batch [ Ports.inputValue SetValue ] -- raise SetValue msg for each update coming from port\n          , initCmd = Cmd.none\n          }\n          specs\n    \n  -- then your spec can use it in following way\n  it \"should set value of element on init\"\n    [ assert.containsText { text = \"\", selector = \".value\" }\n    , steps.inputViaPort \"inputValue\" (JE.string \"new-value-from-port\")\n    , assert.containsText { text = \"new-value-from-port\", selector = \".value\" }\n    ]\n    \n```\n\nCheck `specs/PortSpec.elm` for details.\n\n\n## Examples\nYou can see examples of tests written in elm-spec in here:\n* https://github.com/gdotdesign/elm-ui/tree/master/spec\n* https://github.com/gdotdesign/elm-dom/tree/master/spec\n* https://github.com/gdotdesign/elm-storage/tree/master/spec\n","maintainers":[{"name":"takaczapka","email":"takaczapka@gmail.com"}],"time":{"modified":"2022-06-27T03:23:22.630Z","created":"2017-06-12T14:22:15.838Z","1.1.1":"2017-06-12T14:22:15.838Z","1.1.3":"2017-07-07T15:40:15.073Z","1.1.4":"2017-07-14T10:29:33.753Z","1.1.5":"2017-07-14T13:54:18.347Z"},"homepage":"https://github.com/takaczapka/elm-spec#readme","repository":{"type":"git","url":"git+https://github.com/takaczapka/elm-spec.git"},"bugs":{"url":"https://github.com/takaczapka/elm-spec/issues"},"license":"BSD-2-Clause","readmeFilename":"Readme.md"}