refs #569 - strengthened popup tests
Showing
2 changed files
with
11 additions
and
8 deletions
... | @@ -4,16 +4,15 @@ | ... | @@ -4,16 +4,15 @@ |
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
5 | <title>CasperJS test popup</title> | 5 | <title>CasperJS test popup</title> |
6 | </head> | 6 | </head> |
7 | <a href="." class="close">close</a> | ||
8 | <body> | 7 | <body> |
9 | <a href="/tests/site/form.html" target="_blank">new window</a> | 8 | <a href="/tests/site/form.html" target="_blank">new window</a> |
9 | <a href="#" class="close", onclick="w && w.close();return false">close</a> | ||
10 | <script> | 10 | <script> |
11 | var w = window.open("http://localhost:54321/tests/site/index.html", | 11 | var w; |
12 | "popup", "menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300"); | 12 | setTimeout(function() { |
13 | document.querySelector('a').onclick = function onclick(evt) { | 13 | w = window.open("http://localhost:54321/tests/site/index.html", |
14 | evt.preventDefault(); | 14 | "popup", "menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=300"); |
15 | w.close(); | 15 | }, 200); |
16 | }; | ||
17 | </script> | 16 | </script> |
18 | </body> | 17 | </body> |
19 | </html> | 18 | </html> | ... | ... |
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | var utils = require('utils'); | 3 | var utils = require('utils'); |
4 | var x = require('casper').selectXPath; | 4 | var x = require('casper').selectXPath; |
5 | 5 | ||
6 | casper.test.begin('popup tests', 20, function(test) { | 6 | casper.test.begin('popup tests', 22, function(test) { |
7 | casper.once('popup.created', function(popup) { | 7 | casper.once('popup.created', function(popup) { |
8 | test.pass('"popup.created" event is fired'); | 8 | test.pass('"popup.created" event is fired'); |
9 | test.assert(utils.isWebPage(popup), | 9 | test.assert(utils.isWebPage(popup), |
... | @@ -31,6 +31,10 @@ casper.test.begin('popup tests', 20, function(test) { | ... | @@ -31,6 +31,10 @@ casper.test.begin('popup tests', 20, function(test) { |
31 | }); | 31 | }); |
32 | 32 | ||
33 | casper.withPopup('index.html', function() { | 33 | casper.withPopup('index.html', function() { |
34 | test.assertTitle('CasperJS test index', | ||
35 | 'Casper.withPopup() found a popup with expected title'); | ||
36 | test.assertTextExists('three', | ||
37 | 'Casper.withPopup() found a popup with expected text'); | ||
34 | test.assertUrlMatches(/index\.html$/, | 38 | test.assertUrlMatches(/index\.html$/, |
35 | 'Casper.withPopup() switched to popup as current active one'); | 39 | 'Casper.withPopup() switched to popup as current active one'); |
36 | test.assertEval(function() { | 40 | test.assertEval(function() { | ... | ... |
-
Please register or sign in to post a comment