Commit c447f791 c447f79116dd477a264110e5c17113ee2cc5654d by Nicolas Perriault

refs #919 #916 - native use of phantomjs WebPage#reload()

1 parent e14544ab
......@@ -1445,9 +1445,8 @@ Casper.prototype.open = function open(location, settings) {
Casper.prototype.reload = function reload(then) {
"use strict";
this.checkStarted();
// window.location.reload() is broken under phantomjs
this.then(function() {
this.open(this.getCurrentUrl());
this.page.reload();
});
if (utils.isFunction(then)) {
this.then(this.createStep(then));
......
......@@ -37,6 +37,9 @@
(function () {
'use strict';
// Force fields initialization
document.querySelector("input[name=email]").value = "";
// El-cheapo autocomplete
var choices = [
......
/*global casper*/
/*jshint strict:false, maxstatements: 99*/
casper.test.begin('reload() tests', 3, function(test) {
var formUrl = 'tests/site/form.html';
casper.start(formUrl, function() {
this.fill("form", {email: "foo@foo.com"}, false);
});
casper.once("page.resource.requested", function(resource) {
test.assert(resource.url.indexOf(formUrl) > 0);
}).reload(function() {
test.assertUrlMatches(formUrl);
test.assertField("email", "");
}).run(function() {
test.done();
});
});