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
1a50e23d
...
1a50e23d3d92179060f6f90a94af12a98c1f34ac
authored
2013-03-12 13:56:42 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added more waitFor* tests
1 parent
3a4ed2c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
tests/site/waitFor.html
tests/suites/casper/fetchtext.js
tests/suites/casper/wait.js
tests/site/waitFor.html
View file @
1a50e23
...
...
@@ -14,6 +14,7 @@
<div
id=
"textChange"
>
Loading...
</div>
<div
id=
"encoded"
>
Voil
à
</div>
<script>
setTimeout
(
function
()
{
var
li
=
document
.
createElement
(
'li'
)
...
...
tests/suites/casper/fetchtext.js
View file @
1a50e23
/*global casper*/
/*jshint strict:false*/
casper
.
test
.
begin
(
'fetchText() tests'
,
1
,
function
(
test
)
{
casper
.
test
.
begin
(
'fetchText()
basic
tests'
,
1
,
function
(
test
)
{
casper
.
start
(
'tests/site/index.html'
,
function
()
{
test
.
assertEquals
(
this
.
fetchText
(
'ul li'
),
'onetwothree'
,
'Casper.fetchText() can retrieve text contents'
);
...
...
@@ -8,3 +8,14 @@ casper.test.begin('fetchText() tests', 1, function(test) {
test
.
done
();
});
});
casper
.
test
.
begin
(
'fetchText() handles HTML entities'
,
1
,
function
(
test
)
{
casper
.
start
().
then
(
function
()
{
this
.
setContent
(
'<html><body>Voilà</body></html>'
);
test
.
assertEquals
(
this
.
fetchText
(
'body'
),
'Voilà'
,
'Casper.fetchText() fetches decoded text'
);
});
casper
.
run
(
function
()
{
test
.
done
();
});
});
...
...
tests/suites/casper/wait.js
View file @
1a50e23
...
...
@@ -77,7 +77,7 @@ casper.test.begin('waitForSelector() tests', 1, function(test) {
});
});
casper
.
test
.
begin
(
'waitForText() tests'
,
2
,
function
(
test
)
{
casper
.
test
.
begin
(
'waitForText() tests'
,
4
,
function
(
test
)
{
casper
.
start
(
'tests/site/waitFor.html'
);
casper
.
waitForText
(
'<li>four</li>'
,
function
()
{
...
...
@@ -92,6 +92,12 @@ casper.test.begin('waitForText() tests', 2, function(test) {
test
.
fail
(
'Casper.waitForText() can wait for regexp'
);
});
casper
.
reload
().
waitForText
(
'Voilà'
,
function
()
{
test
.
pass
(
'Casper.waitForText() can wait for decoded HTML text'
);
},
function
()
{
test
.
fail
(
'Casper.waitForText() can wait for decoded HTML text'
);
},
1000
);
casper
.
run
(
function
()
{
test
.
done
();
});
...
...
Please
register
or
sign in
to post a comment