Created
August 21, 2013 10:27
-
-
Save florinel-chis/6292830 to your computer and use it in GitHub Desktop.
Sample CasperJS test to check if a div identified by a class (".col-main") is present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Test if a div with the class .col-main is present on homepage | |
| */ | |
| console.log('checking cli options'); | |
| var casper_cli = require("casper").create(); | |
| if(!casper_cli.cli.options.url){ | |
| console.log("--url=domain.com missing"); | |
| casper_cli.exit(); | |
| } | |
| casper.test.begin('Looking at the homepage now', 1, function suite(test) { | |
| //load up the login page and make sure it loads properly | |
| casper.start("http://"+casper.cli.options.url+'/', function() { | |
| console.log("Loading "+casper.cli.options.url); | |
| test.assertExists('div.col-main','Main column is found'); | |
| }); | |
| casper.run(function() { | |
| test.done(); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment