Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
85bf42f3
...
85bf42f31e799cddbd5929d4394d73f2d94abdc6
authored
2013-08-12 14:03:31 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refs #569 - strengthened popup tests
1 parent
2b185aac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
tests/site/popup.html
tests/suites/casper/popup.js
tests/site/popup.html
View file @
85bf42f
...
...
@@ -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>
...
...
tests/suites/casper/popup.js
View file @
85bf42f
...
...
@@ -3,7 +3,7 @@
var
utils
=
require
(
'utils'
);
var
x
=
require
(
'casper'
).
selectXPath
;
casper
.
test
.
begin
(
'popup tests'
,
2
0
,
function
(
test
)
{
casper
.
test
.
begin
(
'popup tests'
,
2
2
,
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
()
{
...
...
Please
register
or
sign in
to post a comment