more testing cleanup

This commit is contained in:
gregwebs 2012-03-16 22:20:16 -07:00
parent 17cecdad80
commit 32d11e886d
8 changed files with 38 additions and 61 deletions

View File

@ -38,7 +38,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app.
mySuite = do
describe "Basic navigation and assertions" $ 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
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
-- 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
-- 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"
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.
addFile "file_field_name" "path/to/local/file" "image/jpeg"

View File

@ -4,7 +4,7 @@ license: BSD3
license-file: LICENSE
author: 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
stability: Experimental
cabal-version: >= 1.6

View File

@ -199,7 +199,7 @@ scaffold = do
when useTests $ do
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")
$(runIO (S.readFile "scaffold/static/js/modernizr.js.cg") >>= \bs ->

View File

@ -16,27 +16,4 @@ test-suite integration-tests
FlexibleContexts
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
, 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

View File

@ -1,13 +1,10 @@
<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>
<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
<em>Handler/Root.hs</em>.

View File

@ -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.";

View File

@ -12,19 +12,19 @@ import qualified Database.Persist.Store
import Database.Persist.GenericSql (runMigration)
import Yesod.Default.Config
import Yesod.Test
import Network.HTTP.Conduit (newManagerIO)
import Network.HTTP.Conduit (newManager, def)
import Application()
main :: IO a
main = do
conf <- loadConfig $ (configSettings Testing) { csParseExtra = parseExtra }
manager <- newManagerIO 10
manager <- newManager def
logger <- defaultDevelopmentLogger
dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf)
Database.Persist.Store.loadConfig
s <- static Settings.staticDir
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
allTests :: Specs

View File

@ -19,46 +19,49 @@ homepage: http://www.yesodweb.com/
extra-source-files:
input/*.cg
scaffold/templates/default-layout.lucius.cg
scaffold/templates/homepage.lucius.cg
scaffold/Model.hs.cg
scaffold/Import.hs.cg
scaffold/Foundation.hs.cg
scaffold/LICENSE.cg
scaffold/project.cabal.cg
scaffold/mongoDBConnPool.cg
scaffold/tiny/Import.hs.cg
scaffold/tiny/Foundation.hs.cg
scaffold/main.hs.cg
scaffold/static/js/modernizr.js.cg
scaffold/postgresqlConnPool.cg
scaffold/Foundation.hs.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/config/routes.cg
scaffold/tiny/Settings.hs.cg
scaffold/templates/normalize.lucius.cg
scaffold/postgresqlConnPool.cg
scaffold/sqliteConnPool.cg
scaffold/cabal_test_suite.cg
scaffold/Import.hs.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/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/main.hs.cg
scaffold/devel.hs.cg
scaffold/templates/homepage.hamlet.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/messages/en.msg.cg
scaffold/config/models.cg
scaffold/config/mysql.yml.cg
scaffold/config/sqlite.yml.cg
scaffold/config/settings.yml.cg
scaffold/config/favicon.ico.cg
scaffold/config/postgresql.yml.cg
scaffold/config/mysql.yml.cg
scaffold/config/mongoDB.yml.cg
scaffold/config/routes.cg
scaffold/config/robots.txt.cg
scaffold/Settings.hs.cg
scaffold/Settings/StaticFiles.hs.cg
scaffold/messages/en.msg.cg
scaffold/static/js/modernizr.js.cg
scaffold/config/mongoDB.yml.cg
scaffold/devel.hs.cg
flag ghc7