added Tester.assertHttpStatus() for testing HTTP status code
Showing
1 changed file
with
11 additions
and
1 deletions
... | @@ -160,7 +160,7 @@ var Tester = function(casper, options) { | ... | @@ -160,7 +160,7 @@ var Tester = function(casper, options) { |
160 | * Asserts that an element matching the provided CSS3 selector exists in | 160 | * Asserts that an element matching the provided CSS3 selector exists in |
161 | * remote DOM. | 161 | * remote DOM. |
162 | * | 162 | * |
163 | * @param String selector CSS3 selectore | 163 | * @param String selector CSS3 selector |
164 | * @param String message Test description | 164 | * @param String message Test description |
165 | */ | 165 | */ |
166 | this.assertExists = function assertExists(selector, message) { | 166 | this.assertExists = function assertExists(selector, message) { |
... | @@ -168,6 +168,16 @@ var Tester = function(casper, options) { | ... | @@ -168,6 +168,16 @@ var Tester = function(casper, options) { |
168 | }; | 168 | }; |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * Asserts that current HTTP status is the one passed as argument. | ||
172 | * | ||
173 | * @param Number status HTTP status code | ||
174 | * @param String message Test description | ||
175 | */ | ||
176 | this.assertHttpStatus = function assertHttpStatus(status, message) { | ||
177 | return this.assertEquals(casper.currentHTTPStatus, status, message || f("HTTP status code is %d", status)); | ||
178 | }; | ||
179 | |||
180 | /** | ||
171 | * Asserts that a provided string matches a provided RegExp pattern. | 181 | * Asserts that a provided string matches a provided RegExp pattern. |
172 | * | 182 | * |
173 | * @param String subject The string to test | 183 | * @param String subject The string to test | ... | ... |
-
Please register or sign in to post a comment