 
   it 'should fail when waitFor times out', (done) ->
     thisShouldFailWith
-      before: ->
-        casper.start 'http://bing.com'
       test: ->
         casper.waitForSelector 'h1.nonexistant', ->
           throw new Error 'we found it?!?'
         casper.then -> throw new Error 'this shouldnt get here'
     , 'timeout', done
+
+  it 'should fail when the page times out', (done) ->
+    thisShouldFailWith
+      before: ->
+        casper.start 'http://localhost:10473/'
+      test: ->
+        casper.then ->
+          /mocha-casperjs/.should.matchTitle
+    , 'timeout', done
+
+  xit 'should fail when the page doesnt exist', (done) ->
+    # this should probably be configurable.
+    thisShouldFailWith
+      before: ->
+        casper.start 'http://localhost:10473/echo/404'
+      test: ->
+        casper.then ->
+          /mocha-casperjs/.should.matchTitle
+    , 'timeout', done
+
+  xit 'should fail when the page has an error', (done) ->
+    thisShouldFailWith
+      before: ->
+        casper.start 'http://localhost:10473/echo/500'
+      test: ->
+        casper.then ->
+          /mocha-casperjs/.should.matchTitle
+    , '500', done
+
+  it 'should have a simple test pass', (done) ->
+    thisShouldPass
+      test: ->
+        casper.waitForSelector 'h1', ->
+          /mocha-casperjs/.should.matchTitle
+        casper.then ->
+          'h1'.should.have.textMatch 'Hello World!'
+    , done
 
   after -> server.close()
 


  it 'should not flush steps at other hooks', (done) ->
    thisShouldPass
      before: ->
        casper.start 'http://bing.com/'
      test: ->
        casper.steps.length.should.be.above 0
    , done

      encoding: 'utf8'
    , (err, template) ->
      throw err if err
      testContents = util.format template, test.reporter or 'spec', test.before or (-> casper.start('http://localhost:10473/sample')), test.test, test.after or (->)
      fs.writeFile testfile, testContents, (err) -> throw err if err

  process = spawn('casperjs', [testfile])
