Created
September 13, 2013 22:56
-
-
Save kbingman/6557121 to your computer and use it in GitHub Desktop.
Basic casper.js test
This file contains 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
casper.test.begin('Home Page', function(test) { | |
loginAndPreview(baseUrl, bundleLocation, test); | |
casper.then(function() { | |
// Home body Class | |
test.assertExists('.x-home', 'Home body class'); | |
// Main content | |
test.assertExists('.x-main', 'Main content'); | |
}); | |
casper.then(function() { | |
// Two carousels, one for women, one for men | |
test.assertElementCount('.m-scooch', 3, 'Scooch Containers'); | |
// Women's Products | |
test.assertExists('.x-whats-new-for-women'); | |
test.assertSelectorHasText('.x-whats-new-for-women-header', "what's new women"); | |
test.assertExists('.x-whats-new-for-women .x-product-item:first-child a img'); | |
test.assertElementCount('.x-whats-new-for-women .x-product-item:first-child a.pic img', 1, "Shouldn't have Multiple Images"); | |
test.assertExists('.x-swatch-container li a', "Swatches should be tappable"); | |
// Men's Products | |
test.assertExists('.x-whats-new-for-men'); | |
test.assertSelectorHasText('.x-whats-new-for-men-header', "what's new men"); | |
}); | |
casper.run(function () { | |
// Confirm this test is done | |
test.done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment