Commit 85bf42f3 85bf42f31e799cddbd5929d4394d73f2d94abdc6 by Nicolas Perriault

refs #569 - strengthened popup tests

1 parent 2b185aac
......@@ -4,16 +4,15 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CasperJS test popup</title>
</head>
<a href="." class="close">close</a>
<body>
<a href="/tests/site/form.html" target="_blank">new window</a>
<a href="#" class="close", onclick="w && w.close();return false">close</a>
<script>
var w = window.open("http://localhost:54321/tests/site/index.html",
"popup", "menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300");
document.querySelector('a').onclick = function onclick(evt) {
evt.preventDefault();
w.close();
};
var w;
setTimeout(function() {
w = window.open("http://localhost:54321/tests/site/index.html",
"popup", "menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300");
}, 200);
</script>
</body>
</html>
......
......@@ -3,7 +3,7 @@
var utils = require('utils');
var x = require('casper').selectXPath;
casper.test.begin('popup tests', 20, function(test) {
casper.test.begin('popup tests', 22, function(test) {
casper.once('popup.created', function(popup) {
test.pass('"popup.created" event is fired');
test.assert(utils.isWebPage(popup),
......@@ -31,6 +31,10 @@ casper.test.begin('popup tests', 20, function(test) {
});
casper.withPopup('index.html', function() {
test.assertTitle('CasperJS test index',
'Casper.withPopup() found a popup with expected title');
test.assertTextExists('three',
'Casper.withPopup() found a popup with expected text');
test.assertUrlMatches(/index\.html$/,
'Casper.withPopup() switched to popup as current active one');
test.assertEval(function() {
......