preview = do
  bodyContains "Enter a new article"

  action <- formActionValue ".articleDetailBody form"
  liftIO $ I.unpack action `shouldStartWith` "/blog/"

  let req = do setMethod methodPost
               setUrl $ "http://localhost:3000" ++ I.unpack action
               byLabel "Subject:" "subject"
               byLabel "Body:" "body"
               addPostParam "preview" "Preview"
               addToken
  I.request req
  statusIs 200
  bodyContains "Preview your submission"

---------------------------- Preview page ----------------------------
preview = do
  bodyContains "Enter a new article"

  action <- formActionValue ".articleDetailBody form"
  liftIO $ I.unpack action `shouldStartWith` "/blog/"

  let req = do setMethod methodPost
               setUrl $ "http://localhost:3000" ++ I.unpack action
               byLabel "Subject:" "subject"
               byLabel "Body:" "body"
               addPostParam "preview" "Preview"
               addToken
  I.request req
  statusIs 200
  bodyContains "Preview your submission"

---------------------------- Preview page ----------------------------
preview = do
  bodyContains "Enter a new article"

  action <- formActionValue ".articleDetailBody form"
  liftIO $ I.unpack action `shouldStartWith` "/blog/"

  let req = do setMethod methodPost
               setUrl $ "http://localhost:3000" ++ I.unpack action
               byLabel "Subject:" "subject"
               byLabel "Body:" "body"
               addPostParam "preview" "Preview"
               addToken
  I.request req
  statusIs 200
  bodyContains "Preview your submission"

---------------------------- Preview page ----------------------------