refs #919 #916 - native use of phantomjs WebPage#reload()
Showing
3 changed files
with
22 additions
and
2 deletions
... | @@ -1445,9 +1445,8 @@ Casper.prototype.open = function open(location, settings) { | ... | @@ -1445,9 +1445,8 @@ Casper.prototype.open = function open(location, settings) { |
1445 | Casper.prototype.reload = function reload(then) { | 1445 | Casper.prototype.reload = function reload(then) { |
1446 | "use strict"; | 1446 | "use strict"; |
1447 | this.checkStarted(); | 1447 | this.checkStarted(); |
1448 | // window.location.reload() is broken under phantomjs | ||
1449 | this.then(function() { | 1448 | this.then(function() { |
1450 | this.open(this.getCurrentUrl()); | 1449 | this.page.reload(); |
1451 | }); | 1450 | }); |
1452 | if (utils.isFunction(then)) { | 1451 | if (utils.isFunction(then)) { |
1453 | this.then(this.createStep(then)); | 1452 | this.then(this.createStep(then)); | ... | ... |
... | @@ -37,6 +37,9 @@ | ... | @@ -37,6 +37,9 @@ |
37 | (function () { | 37 | (function () { |
38 | 'use strict'; | 38 | 'use strict'; |
39 | 39 | ||
40 | // Force fields initialization | ||
41 | document.querySelector("input[name=email]").value = ""; | ||
42 | |||
40 | // El-cheapo autocomplete | 43 | // El-cheapo autocomplete |
41 | 44 | ||
42 | var choices = [ | 45 | var choices = [ | ... | ... |
tests/suites/casper/reload.js
0 → 100644
1 | /*global casper*/ | ||
2 | /*jshint strict:false, maxstatements: 99*/ | ||
3 | |||
4 | casper.test.begin('reload() tests', 3, function(test) { | ||
5 | var formUrl = 'tests/site/form.html'; | ||
6 | |||
7 | casper.start(formUrl, function() { | ||
8 | this.fill("form", {email: "foo@foo.com"}, false); | ||
9 | }); | ||
10 | casper.once("page.resource.requested", function(resource) { | ||
11 | test.assert(resource.url.indexOf(formUrl) > 0); | ||
12 | }).reload(function() { | ||
13 | test.assertUrlMatches(formUrl); | ||
14 | test.assertField("email", ""); | ||
15 | }).run(function() { | ||
16 | test.done(); | ||
17 | }); | ||
18 | }); |
-
Please register or sign in to post a comment