added a Casper.history property, storing all the browsed urls
Showing
2 changed files
with
6 additions
and
0 deletions
... | @@ -53,6 +53,7 @@ | ... | @@ -53,6 +53,7 @@ |
53 | timeout: null, | 53 | timeout: null, |
54 | verbose: false | 54 | verbose: false |
55 | }; | 55 | }; |
56 | // privates | ||
56 | // local properties | 57 | // local properties |
57 | this.checker = null; | 58 | this.checker = null; |
58 | this.colorizer = new phantom.Casper.Colorizer(); | 59 | this.colorizer = new phantom.Casper.Colorizer(); |
... | @@ -1605,6 +1606,8 @@ | ... | @@ -1605,6 +1606,8 @@ |
1605 | } else { | 1606 | } else { |
1606 | casper.log("Successfully injected Casper client-side utilities", "debug"); | 1607 | casper.log("Successfully injected Casper client-side utilities", "debug"); |
1607 | } | 1608 | } |
1609 | // history | ||
1610 | casper.history.push(casper.getCurrentUrl()); | ||
1608 | casper.loadInProgress = false; | 1611 | casper.loadInProgress = false; |
1609 | }; | 1612 | }; |
1610 | page.onResourceReceived = function(resource) { | 1613 | page.onResourceReceived = function(resource) { | ... | ... |
... | @@ -210,5 +210,8 @@ casper.wait(1000, function(self) { | ... | @@ -210,5 +210,8 @@ casper.wait(1000, function(self) { |
210 | casper.run(function(self) { | 210 | casper.run(function(self) { |
211 | self.test.comment('logging, again'); | 211 | self.test.comment('logging, again'); |
212 | self.test.assertEquals(self.result.log.length, 3, 'log() logged messages'); | 212 | self.test.assertEquals(self.result.log.length, 3, 'log() logged messages'); |
213 | self.test.comment('history'); | ||
214 | self.test.assert(self.history.length > 0, 'Casper.history contains urls'); | ||
215 | self.test.assertMatch(self.history[0], /tests\/site\/index\.html$/, 'Casper.history has the correct first url'); | ||
213 | self.test.renderResults(true, 0, save); | 216 | self.test.renderResults(true, 0, save); |
214 | }); | 217 | }); | ... | ... |
-
Please register or sign in to post a comment