more testing cleanup
This commit is contained in:
parent
17cecdad80
commit
32d11e886d
@ -38,7 +38,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app.
|
|||||||
mySuite = do
|
mySuite = do
|
||||||
describe "Basic navigation and assertions" $ do
|
describe "Basic navigation and assertions" $ do
|
||||||
it "Gets a page that has a form, with auto generated fields and token" $ do
|
it "Gets a page that has a form, with auto generated fields and token" $ do
|
||||||
doGet_ "url/of/page/with/form" -- Load a page
|
get_ "url/of/page/with/form" -- Load a page
|
||||||
statusIs 200 -- Assert the status was success
|
statusIs 200 -- Assert the status was success
|
||||||
|
|
||||||
bodyContains "Hello Person" -- Assert any part of the document contains some text.
|
bodyContains "Hello Person" -- Assert any part of the document contains some text.
|
||||||
@ -48,7 +48,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app.
|
|||||||
htmlAllContain "h1#mainTitle" "Sign Up Now!" -- All matches have some text
|
htmlAllContain "h1#mainTitle" "Sign Up Now!" -- All matches have some text
|
||||||
|
|
||||||
-- Performs the post using the current page to extract field values:
|
-- Performs the post using the current page to extract field values:
|
||||||
doPost "url/to/post/to" $ do
|
post "url/to/post/to" $ do
|
||||||
addNonce -- Add the _nonce field with the currently shown value
|
addNonce -- Add the _nonce field with the currently shown value
|
||||||
|
|
||||||
-- Lookup field by the text on the labels pointing to them.
|
-- Lookup field by the text on the labels pointing to them.
|
||||||
@ -57,7 +57,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app.
|
|||||||
byLabel "Confirm:" "secret"
|
byLabel "Confirm:" "secret"
|
||||||
|
|
||||||
it "Sends another form, this one has a file" $ do
|
it "Sends another form, this one has a file" $ do
|
||||||
doPost "url/to/post/file/to" $ do
|
post "url/to/post/file/to" $ do
|
||||||
-- You can add files this easy, you still have to provide the mime type manually though.
|
-- You can add files this easy, you still have to provide the mime type manually though.
|
||||||
addFile "file_field_name" "path/to/local/file" "image/jpeg"
|
addFile "file_field_name" "path/to/local/file" "image/jpeg"
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ license: BSD3
|
|||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Nubis <nubis@woobiz.com.ar>
|
author: Nubis <nubis@woobiz.com.ar>
|
||||||
maintainer: Nubis <nubis@woobiz.com.ar>
|
maintainer: Nubis <nubis@woobiz.com.ar>
|
||||||
synopsis: Behaviour Oriented integration Testing for Yesod Applications
|
synopsis: integration testing for WAI/Yesod Applications
|
||||||
category: Web, Yesod, Testing
|
category: Web, Yesod, Testing
|
||||||
stability: Experimental
|
stability: Experimental
|
||||||
cabal-version: >= 1.6
|
cabal-version: >= 1.6
|
||||||
|
|||||||
@ -199,7 +199,7 @@ scaffold = do
|
|||||||
|
|
||||||
when useTests $ do
|
when useTests $ do
|
||||||
mkDir "tests"
|
mkDir "tests"
|
||||||
writeFile' "tests/main.hs" $(codegen "tests_main.hs")
|
writeFile' "tests/main.hs" $(codegen "tests/main.hs")
|
||||||
|
|
||||||
S.writeFile (dir ++ "/static/js/modernizr.js")
|
S.writeFile (dir ++ "/static/js/modernizr.js")
|
||||||
$(runIO (S.readFile "scaffold/static/js/modernizr.js.cg") >>= \bs ->
|
$(runIO (S.readFile "scaffold/static/js/modernizr.js.cg") >>= \bs ->
|
||||||
|
|||||||
@ -16,27 +16,4 @@ test-suite integration-tests
|
|||||||
FlexibleContexts
|
FlexibleContexts
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 0.10 && < 0.11
|
|
||||||
, yesod-core >= 0.10 && < 0.11
|
|
||||||
, yesod-auth >= 0.8 && < 0.9
|
|
||||||
, yesod-static >= 0.10 && < 0.11
|
|
||||||
, yesod-default >= 0.6 && < 0.7
|
|
||||||
, yesod-form >= 0.4 && < 0.5
|
|
||||||
, yesod-test >= 0.1 && < 0.2
|
, yesod-test >= 0.1 && < 0.2
|
||||||
, mime-mail >= 0.3.0.3 && < 0.5
|
|
||||||
, clientsession >= 0.7.3 && < 0.8
|
|
||||||
, bytestring >= 0.9 && < 0.10
|
|
||||||
, text >= 0.11 && < 0.12
|
|
||||||
, persistent >= 0.7 && < 0.8
|
|
||||||
, persistent-sqlite >= 0.7 && < 0.8
|
|
||||||
, template-haskell
|
|
||||||
, hamlet >= 0.10 && < 0.11
|
|
||||||
, shakespeare-css >= 0.10 && < 0.11
|
|
||||||
, shakespeare-js >= 0.10 && < 0.11
|
|
||||||
, shakespeare-text >= 0.10 && < 0.11
|
|
||||||
, hjsmin >= 0.0.14 && < 0.1
|
|
||||||
, monad-control >= 0.3 && < 0.4
|
|
||||||
, wai-extra >= 1.0 && < 1.1
|
|
||||||
, yaml >= 0.5 && < 0.6
|
|
||||||
, http-conduit >= 1.1 && < 1.2
|
|
||||||
, haskell98
|
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
<h1>_{MsgHello}
|
<h1>_{MsgHello}
|
||||||
|
|
||||||
<p>Now that you have a working project you should use the
|
|
||||||
<a href="http://www.yesodweb.com/book/">Yesod book</a> to learn more.
|
|
||||||
|
|
||||||
<p>
|
|
||||||
You can also use this scaffolded site to explore some basic concepts, these are
|
|
||||||
the main things to look at:
|
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
<li>Now that you have a working project you should use the #
|
||||||
|
<a href="http://www.yesodweb.com/book/">Yesod book</a> to learn more.
|
||||||
|
You can also use this scaffolded site to explore some basic concepts.
|
||||||
|
|
||||||
<li> This page was generated by the #{handlerName} handler in
|
<li> This page was generated by the #{handlerName} handler in
|
||||||
<em>Handler/Root.hs</em>.
|
<em>Handler/Root.hs</em>.
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
document.getElementById("#{h2id}").innerHTML = "<i>Added from JavaScript.</i>";
|
document.getElementById("#{aDomId}").innerHTML = "This text was added by the Javascript part of the homepage widget.";
|
||||||
|
|||||||
@ -12,19 +12,19 @@ import qualified Database.Persist.Store
|
|||||||
import Database.Persist.GenericSql (runMigration)
|
import Database.Persist.GenericSql (runMigration)
|
||||||
import Yesod.Default.Config
|
import Yesod.Default.Config
|
||||||
import Yesod.Test
|
import Yesod.Test
|
||||||
import Network.HTTP.Conduit (newManagerIO)
|
import Network.HTTP.Conduit (newManager, def)
|
||||||
import Application()
|
import Application()
|
||||||
|
|
||||||
main :: IO a
|
main :: IO a
|
||||||
main = do
|
main = do
|
||||||
conf <- loadConfig $ (configSettings Testing) { csParseExtra = parseExtra }
|
conf <- loadConfig $ (configSettings Testing) { csParseExtra = parseExtra }
|
||||||
manager <- newManagerIO 10
|
manager <- newManager def
|
||||||
logger <- defaultDevelopmentLogger
|
logger <- defaultDevelopmentLogger
|
||||||
dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf)
|
dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf)
|
||||||
Database.Persist.Store.loadConfig
|
Database.Persist.Store.loadConfig
|
||||||
s <- static Settings.staticDir
|
s <- static Settings.staticDir
|
||||||
p <- Database.Persist.Store.createPoolConfig (dbconf :: Settings.PersistConfig)~runMigration~
|
p <- Database.Persist.Store.createPoolConfig (dbconf :: Settings.PersistConfig)~runMigration~
|
||||||
app <- toWaiAppPlain $ ~sitearg~ conf logger s p manager
|
app <- toWaiAppPlain $ ~sitearg~ conf logger s p manager dbconf
|
||||||
runTests app p allTests
|
runTests app p allTests
|
||||||
|
|
||||||
allTests :: Specs
|
allTests :: Specs
|
||||||
@ -19,46 +19,49 @@ homepage: http://www.yesodweb.com/
|
|||||||
|
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
input/*.cg
|
input/*.cg
|
||||||
scaffold/templates/default-layout.lucius.cg
|
|
||||||
scaffold/templates/homepage.lucius.cg
|
|
||||||
scaffold/Model.hs.cg
|
scaffold/Model.hs.cg
|
||||||
scaffold/Import.hs.cg
|
|
||||||
scaffold/Foundation.hs.cg
|
|
||||||
scaffold/LICENSE.cg
|
scaffold/LICENSE.cg
|
||||||
|
scaffold/project.cabal.cg
|
||||||
scaffold/mongoDBConnPool.cg
|
scaffold/mongoDBConnPool.cg
|
||||||
scaffold/tiny/Import.hs.cg
|
scaffold/main.hs.cg
|
||||||
scaffold/tiny/Foundation.hs.cg
|
scaffold/static/js/modernizr.js.cg
|
||||||
|
scaffold/postgresqlConnPool.cg
|
||||||
|
scaffold/Foundation.hs.cg
|
||||||
scaffold/tiny/project.cabal.cg
|
scaffold/tiny/project.cabal.cg
|
||||||
|
scaffold/tiny/Foundation.hs.cg
|
||||||
|
scaffold/tiny/Import.hs.cg
|
||||||
|
scaffold/tiny/Settings.hs.cg
|
||||||
scaffold/tiny/Application.hs.cg
|
scaffold/tiny/Application.hs.cg
|
||||||
scaffold/tiny/config/routes.cg
|
scaffold/tiny/config/routes.cg
|
||||||
scaffold/tiny/Settings.hs.cg
|
|
||||||
scaffold/templates/normalize.lucius.cg
|
|
||||||
scaffold/postgresqlConnPool.cg
|
|
||||||
scaffold/sqliteConnPool.cg
|
scaffold/sqliteConnPool.cg
|
||||||
|
scaffold/cabal_test_suite.cg
|
||||||
|
scaffold/Import.hs.cg
|
||||||
scaffold/.ghci.cg
|
scaffold/.ghci.cg
|
||||||
scaffold/project.cabal.cg
|
scaffold/tests/main.hs.cg
|
||||||
|
scaffold/Settings.hs.cg
|
||||||
|
scaffold/Settings/StaticFiles.hs.cg
|
||||||
scaffold/Application.hs.cg
|
scaffold/Application.hs.cg
|
||||||
scaffold/templates/homepage.julius.cg
|
|
||||||
scaffold/templates/homepage.hamlet.cg
|
|
||||||
scaffold/templates/default-layout.hamlet.cg
|
|
||||||
scaffold/templates/default-layout-wrapper.hamlet.cg
|
|
||||||
scaffold/deploy/Procfile.cg
|
scaffold/deploy/Procfile.cg
|
||||||
scaffold/main.hs.cg
|
scaffold/templates/homepage.hamlet.cg
|
||||||
scaffold/devel.hs.cg
|
scaffold/templates/default-layout.lucius.cg
|
||||||
|
scaffold/templates/default-layout.hamlet.cg
|
||||||
|
scaffold/templates/homepage.julius.cg
|
||||||
|
scaffold/templates/default-layout-wrapper.hamlet.cg
|
||||||
|
scaffold/templates/normalize.lucius.cg
|
||||||
|
scaffold/templates/boilerplate-wrapper.hamlet.cg
|
||||||
|
scaffold/templates/homepage.lucius.cg
|
||||||
scaffold/Handler/Root.hs.cg
|
scaffold/Handler/Root.hs.cg
|
||||||
|
scaffold/messages/en.msg.cg
|
||||||
scaffold/config/models.cg
|
scaffold/config/models.cg
|
||||||
|
scaffold/config/mysql.yml.cg
|
||||||
scaffold/config/sqlite.yml.cg
|
scaffold/config/sqlite.yml.cg
|
||||||
scaffold/config/settings.yml.cg
|
scaffold/config/settings.yml.cg
|
||||||
scaffold/config/favicon.ico.cg
|
scaffold/config/favicon.ico.cg
|
||||||
scaffold/config/postgresql.yml.cg
|
scaffold/config/postgresql.yml.cg
|
||||||
scaffold/config/mysql.yml.cg
|
|
||||||
scaffold/config/mongoDB.yml.cg
|
|
||||||
scaffold/config/routes.cg
|
scaffold/config/routes.cg
|
||||||
scaffold/config/robots.txt.cg
|
scaffold/config/robots.txt.cg
|
||||||
scaffold/Settings.hs.cg
|
scaffold/config/mongoDB.yml.cg
|
||||||
scaffold/Settings/StaticFiles.hs.cg
|
scaffold/devel.hs.cg
|
||||||
scaffold/messages/en.msg.cg
|
|
||||||
scaffold/static/js/modernizr.js.cg
|
|
||||||
|
|
||||||
|
|
||||||
flag ghc7
|
flag ghc7
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user