Last active
June 21, 2017 08:33
-
-
Save PramodDutta/5527dc795b1c0a1a14b1144fe242e0e0 to your computer and use it in GitHub Desktop.
Casper Quick Walkthrough
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
| ##Asserts - | |
| * assert() | |
| * assertDoesntExist() | |
| * assertEquals() | |
| * assertEval() | |
| * assertEvalEquals() | |
| * assertElementCount() | |
| * assertExists() | |
| * assertFalsy() | |
| * assertField() | |
| * assertFieldName() | |
| * assertFieldCSS() | |
| * assertFieldXPath() | |
| * assertHttpStatus() | |
| * assertMatch() | |
| * assertNot() | |
| * assertNotEquals() | |
| * assertNotVisible() | |
| * assertRaises() | |
| * assertSelectorDoesntHaveText() | |
| * assertSelectorHasText() | |
| * assertResourceExists() | |
| * assertTextExists() | |
| * assertTextDoesntExist() | |
| * assertTitle() | |
| * assertTitleMatch() | |
| * assertTruthy() | |
| * assertType() | |
| * assertInstanceOf() | |
| * assertUrlMatch() | |
| * assertVisible() | |
| * assertAllVisible() | |
| * begin() | |
| * colorize() | |
| * comment() | |
| * done() | |
| * error() | |
| * fail() | |
| * formatMessage() | |
| * getFailures() | |
| * getPasses() | |
| * info() | |
| * pass() | |
| * renderResults() | |
| * setUp() | |
| * skip() | |
| * tearDown() | |
| * test.assertExists('h1.page-title'); | |
| * test.assertSelectorHasText('h1.page-title', 'Hello’); | |
| * test.assertVisible('footer’); | |
| this.test.assertExists({ | |
| type: 'xpath', | |
| path: '//*[@class="plop"]' | |
| }, 'the element exists'); | |
| test.assertUrlMatch(/q=casperjs/, "search term has been submitted”); | |
| test.assertEval(function() { | |
| return __utils__.findAll("h3.r").length >= 10; | |
| }, "google search for \"casperjs\" retrieves 10 or more results"); | |
| Command line Operations | |
| --fail-fast will terminate the current test suite as soon as a first failure is encountered. | |
| --pre=pre-test.js | |
| --post=post-test.js | |
| --concise will create a more concise output of the test suite. | |
| Running Multiple Casper Test | |
| https://gist.github.com/n1k0/3813361 | |
| Assuming - test1.js and test2.js into a tests/ | |
| casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment