Browse files

small changes, move js deps local so we do not have to pass --local-t…

…o-remote-url-access to phantom
  • Loading branch information...
cwinters committed Apr 23, 2012
1 parent e0a4ee5 commit bc58eaa3745e667dc67f5ddaedcf69e8587507a5
@@ -1,6 +1,6 @@
# README: 2012-April Introduction to CasperJS
You should be able to open the web page `web/index.html` and see
You should be able to open the web page `web/sample_form.html` and see
what's going on -- fill out the form, click on elements, etc.
To run CasperJS against it you'll need to put the `web` directory
@@ -0,0 +1,13 @@
var casper = require( 'casper' ).create();
casper.start( 'web/sample_form.html', function() {
this.capture( 'initial_form.png' ); '#sample_form_submit' );
this.capture( 'after_fill.png' );
this.test.assertMatch( this.fetchText( '#errors' ),
/Person name is required/, 'Valid error for missing person name' );
}); function() {
this.test.renderResults( true );
@@ -14,20 +14,22 @@ This example is on [github][samplerepo] and can be used without a
webserver. It has a simple form with:
* sections that are conditionally displayed,
* form elements dynamically generated from JSON fetched via AJAX,
* validation on submit
To test it out, just open the file `web/sample_form.html` in a
One note -- if you're using Chrome you need to start it like
google-chrome --allow-file-access-from-files
Otherwise the AJAX calls won't be able to load the static JSON
files (see [#40787][chromefile]).
First a quick example of a test:
files (see [#40787][chromefile]). Firefox should work fine.
- what are some good examples? create/download a simple todo-list
application? Maybe re-use notem?
First a quick example of a test. We want to ensure that the
person's name is required.
## Pros and cons of single programming environment

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -3,13 +3,12 @@
<title>Sample form for Casper testing</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="jquery-1.7.1-min.js"></script>
<script type="text/javascript" src="underscore-1.3.1-min.js"></script>
<script type="text/javascript" src="sample_form.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="sample_form.js"></script>
<div id="errors"></div>
@@ -34,7 +33,7 @@
<div class="indent">
<select name="physician">
<select name="physician" id="physician">
<option value="">Please select...</option>
<option value="452">Dr. Benjamin Franklin Pierce</option>
<option value="644">Dr. Jack Shephard</option>
@@ -101,7 +100,7 @@
<input type="submit" value="Go!" />
<input type="submit" value="Go!" id="sample_form_submit" />

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit bc58eaa

Please sign in to comment.