Skip to content

Commit e85c840

Browse files
committed
Merge pull request #214 from marcjansen/headless
Enable headless testing through casperjs. (r=@chrismayer)
2 parents 7a76330 + ac3ea46 commit e85c840

File tree

198 files changed

+14986
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+14986
-4
lines changed

tests/data/MapfishPrintProvider.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
t.plan(2);
115115

116116
var getAbsoluteUrl = GeoExt.data.MapfishPrintProvider.prototype.getAbsoluteUrl;
117-
var baseUrl = parent.location.href.substr(0, parent.location.href.indexOf("/tests/run-tests.html"));
117+
var baseUrl = location.href.substr(0, location.href.indexOf("/tests/data/MapfishPrintProvider.html"));
118118
t.eq(getAbsoluteUrl("/foo/bar.html"), location.protocol + "//" + location.host + "/foo/bar.html", "Relative url converted to absolute url correctly.");
119119
t.eq(getAbsoluteUrl("../../bar.html"), baseUrl + "/bar.html", "Relative url with relative path converted to absolute url correctly.");
120120
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
/*.xml
3+
/*.png
4+
/docs/*.js
5+
/docs/*.xml
6+
/docs/_build
7+
/tmp

tests/headless/casperjs-1.1-beta.1/.gitmodules

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
docs
2+
modules/vendors
3+
modules/events.js
4+
modules/querystring.js
5+
samples/**
6+
tests/clitests/**
7+
tests/testdir/**
8+
tmp
9+
./*.js
10+
./phantomjs*/*
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"asi": true,
3+
"browser": true,
4+
"debug": true,
5+
"devel": true,
6+
"eqeqeq": true,
7+
"evil": true,
8+
"maxparams": 5,
9+
"maxdepth": 3,
10+
"maxstatements": 15,
11+
"maxcomplexity": 7,
12+
"proto": true,
13+
"regexdash": true,
14+
"strict": true,
15+
"sub": true,
16+
"trailing": true,
17+
"undef": true,
18+
19+
"predef" : [
20+
"exports",
21+
"phantom",
22+
"window",
23+
"require"
24+
]
25+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
branches:
2+
only:
3+
- "master"
4+
5+
before_install:
6+
- echo "installing PhantomJS 1.8.2"
7+
- wget http://phantomjs.googlecode.com/files/phantomjs-1.8.2-linux-x86_64.tar.bz2
8+
- tar -xvf phantomjs-1.8.2-linux-x86_64.tar.bz2
9+
- sudo mv phantomjs-1.8.2-linux-x86_64/bin/phantomjs bin/phantomjs182
10+
- ls -la bin/phantomjs182
11+
- bin/phantomjs182 --version
12+
- echo "installing PhantomJS 1.9.0"
13+
- wget http://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2
14+
- tar -xvf phantomjs-1.9.0-linux-x86_64.tar.bz2
15+
- sudo mv phantomjs-1.9.0-linux-x86_64/bin/phantomjs bin/phantomjs190
16+
- bin/phantomjs190 --version
17+
- ls -la bin/phantomjs190
18+
19+
before_script:
20+
- "npm install -g [email protected]"
21+
- bin/phantomjs182 --version
22+
- bin/phantomjs190 --version
23+
24+
script:
25+
- make test
26+
27+
env:
28+
matrix:
29+
- PHANTOMJS_EXECUTABLE="bin/phantomjs182 --local-to-remote-url-access=yes --ignore-ssl-errors=yes"
30+
- PHANTOMJS_EXECUTABLE="bin/phantomjs190 --local-to-remote-url-access=yes --ignore-ssl-errors=yes"
31+
32+
notifications:
33+
irc:
34+
channels:
35+
- "irc.freenode.org#casperjs"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[This file has moved to Github](https://github.com/n1k0/casperjs/releases)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Contribution Guide
2+
3+
*Note: this guide has been heavily inspired by [PhantomJS' one](https://github.com/ariya/phantomjs/blob/master/CONTRIBUTING.md).*
4+
5+
**This page describes how to contribute changes to the [CasperJS](http://casperjs.org/) project.**
6+
7+
Please do **not** create a pull request without reading this guide first. Failure to do so may result in the **rejection** of the pull request.
8+
9+
## For The Impatients
10+
11+
**Work on a feature branch**.
12+
If your changes need to be modified due to some reviews, it is less clutter to tweak an isolated feature branch and push it again.
13+
14+
**Create a ticket in the [issue tracker](https://github.com/n1k0/casperjs/issues/)**.
15+
This serves as a placeholder for important feedback, review, or any future updates. **Please ensure searching the bugtracker for an already opened issue matching your case before filing a new issue.**
16+
17+
In the commit message(s):
18+
19+
* **Keep the first line short**. Write additional paragraphs if necessary.
20+
* **Reference an opened issue**, by referencing the issue ID prefixed by a `#` and the keyword `refs`, eg. `refs #123`
21+
22+
Sample commit message:
23+
24+
> refs #123 - fixed error message formatting
25+
>
26+
> (optional: a short explanation of what the patch actually does)
27+
28+
**Run tests**
29+
30+
Run CasperJS' test suite to see you didn't break something:
31+
32+
$ casperjs selftest
33+
34+
The result status bar **must be green** before sending your PR.
35+
36+
## Communicate
37+
38+
**Improvement and feature request**. If you have an improvement idea, please send an email to the [mailing list](http://groups.google.com/group/casperjs) (preferable than contacting the developers directly) so that other people can give their insights and opinions. This is also important to avoid duplicate work.
39+
40+
**Help request**. If you're stuck using CasperJS and don't understand how to achieve something, please [ask on the mailing-list](https://groups.google.com/forum/#!forum/casperjs) first. Please don't ask for all the kind people to write your scripts for you.
41+
42+
**Ensure the issue is related to CasperJS**. Please try to reproduce the issue using plain PhantomJS. If it works with the native PhantomJS API but doesn't with CasperJS, then the issue is probably valid. In the opposite case, please file an issue on [PhantomJS issue tracker](http://code.google.com/p/phantomjs/issues/list).
43+
44+
**Extending with new API**. Whenever you want to introduce a new API, please send an email to the mailing list along with the link to the issue if any. It may require few iterations to agree on the final API and hence it is important to engage all interested parties as early as possible.
45+
46+
## Get Ready
47+
48+
### Use Feature Branch
49+
50+
To isolate your change, please avoid working on the master branch. Instead, work on a *feature branch* (often also known as *topic branch*). You can create a new branch (example here crash-fix) off the master branch by using:
51+
52+
git checkout -b crash-fix master
53+
54+
Refer to your favorite Git tutorial/book for further detailed help.
55+
56+
Some good practices for the feature branch:
57+
58+
* Give it a meaningful name instead of, e.g. `prevent-zero-divide` instead of just `fix`
59+
* Make *granular* and *atomic* commits, e.g. do not mix a typo fix with some major refactoring
60+
* Keep one branch for one specific issue. If you need to work on other unrelated issues, create another branch.
61+
62+
### Write tests
63+
64+
CasperJS being partly a testing framework, how irrelevant would be to send a pull request with no test? So, please take the time to write and attach tests to your PR. Furthermore, testing with CasperJS is quite [exhaustively documented](http://casperjs.org/testing.html).
65+
66+
### Run tests!
67+
68+
This may sound obvious but **don't send pull requests which break the casperjs test suite**.
69+
70+
To see if your modifications broke the suite, just run:
71+
72+
$ casperjs selftest
73+
74+
### Write documentation
75+
76+
Do you appreciate the [CasperJS documentation](http://casperjs.org/)? I do too. As the documentation contents are managed and generated using Github, Markdown and CasperJS itself, take the time to read the [Documentation Contribution Guide](https://github.com/n1k0/casperjs/blob/gh-pages/README.md#casperjs-documentation) and write the documentation related to your PR whenever applicable.
77+
78+
**Note:** As the documentation is handled in a [dedicated separated `gh-pages` branch](https://github.com/n1k0/casperjs/tree/gh-pages), you'll have to send a dedicated PR for doc patches. I'm working on a more comfortable solution, but it's no easy task though.
79+
80+
## Review and Merge
81+
82+
When your branch is ready, send the pull request.
83+
84+
While it is not always the case, often it is necessary to improve parts of your code in the branch. This is the actual review process.
85+
86+
Here is a check list for the review:
87+
88+
* It does not break the test suite
89+
* There is no typo
90+
* The coding style follows the existing one
91+
* There is a reasonable amount of comment
92+
* The license header is intact
93+
* All examples are still working
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# CasperJS contributors
2+
3+
You can check out the [contribution graphs on github](https://github.com/n1k0/casperjs/graphs/contributors).
4+
5+
```
6+
$ git shortlog -s -n | cut -c8-
7+
Nicolas Perriault
8+
Laurent Jouanneau
9+
oncletom
10+
Brikou CARRE
11+
hexid
12+
Julien Muetton
13+
hannyu
14+
Chris Bosco
15+
Matt Bowman
16+
Shiryaev Andrey
17+
Chris Lorenzo
18+
Victor Yap
19+
JF Paradis
20+
Rob Barreca
21+
nrabinowitz
22+
pborreli
23+
Darrell Hamilton
24+
Tyler Ritchie
25+
Oleg Pudeyev
26+
renatodarrigo
27+
Clochix
28+
Luke Rodgers
29+
Andrew Childs
30+
reina.sweet
31+
Solomon White
32+
Dave Lee
33+
Michael Geers
34+
Julien Moulin
35+
Philip Hansen
36+
Donovan Hutchinson
37+
Elmar Langholz
38+
Reid Lynch
39+
Reina Sweet
40+
Sean Massa
41+
Thomas Rosenau
42+
Lee Byrd
43+
V Sreekanth
44+
Vladimir Chizhov
45+
Jan Schaumann
46+
Jason Funk
47+
snkashis
48+
Andrew de Andrade
49+
Ben Johnson
50+
Ben Lowery
51+
Charlie Park
52+
Chris Winters
53+
Christophe Benz
54+
Dmitry Menshikov
55+
Harrison Reiser
56+
Itamar Nabriski
57+
Jan Pochyla
58+
Jan-Martin Fruehwacht
59+
Julian Gruber
60+
Justin Marsan
61+
Justin Slattery
62+
Justine Tunney
63+
KaroDidi
64+
Leandro Boscariol
65+
Maisons du monde
66+
Marcel Duran
67+
Mathieu Agopian
68+
Mehdi Kabab
69+
Mickaël Andrieu
70+
Mikko Peltonen
71+
Narno
72+
Orchestrator81
73+
Pascal Borreli
74+
Rafael
75+
Rafael Garcia
76+
Raphaël Benitte
77+
Rock Li
78+
Tim Bunce
79+
Tzvi Friedman
80+
Yevgeny Smirnov
81+
alfetopito
82+
jean-philippe serafin
83+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2011-2012 Nicolas Perriault
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.PHONY: default test docs selftest clitest jshint
2+
3+
default: test
4+
5+
test: selftest clitest jshint
6+
7+
docs:
8+
sphinx-build -b html ./docs docs/_build
9+
10+
selftest:
11+
bin/casperjs selftest
12+
13+
clitest:
14+
python tests/clitests/runtests.py
15+
16+
jshint:
17+
jshint .
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# CasperJS
2+
3+
>**Important note:** the `master` branch hosts the development version of CasperJS, which is now pretty stable and should be the right version to use if you ask me.
4+
>
5+
>Use the [`1.0` branch](https://github.com/n1k0/casperjs/tree/1.0) if you want to keep in sync with the stable old version, or [use tagged versions](https://github.com/n1k0/casperjs/tags).
6+
>
7+
>Currently, available documentation is:
8+
>
9+
>- **hosted on [docs.casperjs.org](http://docs.casperjs.org/) for the development branch**
10+
>- hosted on [casperjs.org](http://casperjs.org/) for the 1.0 branch
11+
>
12+
>[Travis-CI](http://travis-ci.org/n1k0/casperjs) build status:
13+
>
14+
>- ![Build Status](https://travis-ci.org/n1k0/casperjs.png?branch=master) `master` branch
15+
>- 1.0 tests unfortunately have to be run manually using the `casperjs selftest` command
16+
17+
CasperJS is a navigation scripting & testing utility for [PhantomJS](http://www.phantomjs.org/)
18+
and [SlimerJS](http://slimerjs.org/). It eases the process of defining a full navigation
19+
scenario and provides useful high-level functions, methods & syntaxic sugar for doing common
20+
tasks such as:
21+
22+
- defining & ordering [navigation steps](http://casperjs.org/quickstart.html)
23+
- [filling forms](http://casperjs.org/api.html#casper.fill)
24+
- [clicking links](http://casperjs.org/api.html#casper.click)
25+
- [capturing screenshots](http://casperjs.org/api.html#casper.captureSelector) of a page (or an area)
26+
- [making assertions on remote DOM](http://casperjs.org/api.html#tester)
27+
- [logging](http://casperjs.org/logging.html) & [events](http://casperjs.org/events-filters.html)
28+
- [downloading base64](http://casperjs.org/api.html#casper.download) encoded resources, even binary ones
29+
- catching errors and react accordingly
30+
- writing [functional test suites](http://casperjs.org/testing.html), exporting results as JUnit XML (xUnit)
31+
32+
Browse the [sample examples repository](https://github.com/n1k0/casperjs/tree/master/samples).
33+
Don't hesitate to pull request for any cool example of yours as well!
34+
35+
**Read the [full documentation](http://casperjs.org/) on casperjs dedicated website.**
36+
37+
Subscribe to the [project mailing-list](https://groups.google.com/forum/#!forum/casperjs)
38+
39+
Follow the CasperJS project [on twitter](https://twitter.com/casperjs_org) and [Google+](https://plus.google.com/b/106641872690063476159/).
40+
41+
## Show me some code!
42+
43+
Sample test to see if some dropdown can be opened:
44+
45+
```javascript
46+
casper.test.begin('a twitter bootsrap dropdown can be opened', 2, function(test) {
47+
casper.start('http://twitter.github.com/bootstrap/javascript.html#dropdowns', function() {
48+
test.assertExists('#navbar-example');
49+
this.click('#dropdowns .nav-pills .dropdown:last-of-type a.dropdown-toggle');
50+
this.waitUntilVisible('#dropdowns .nav-pills .open', function() {
51+
test.pass('Dropdown is open');
52+
});
53+
}).run(function() {
54+
test.done();
55+
});
56+
});
57+
```
58+
59+
Run the script:
60+
61+
![](http://cl.ly/image/271e2i403A0F/Capture%20d%E2%80%99%C3%A9cran%202013-01-20%20%C3%A0%2009.26.15.png)
62+
63+
##Support
64+
65+
If you're having problems with using the project, use the support forum at CodersClan.
66+
67+
<a href="http://codersclan.net/forum/index.php?repo_id=32"><img src="http://www.codersclan.net/graphics/getSupport_blue_big.png" width="160"></a>
68+
69+
## Contributing
70+
71+
### Contributing code
72+
73+
Please read the [CONTRIBUTING.md](https://github.com/n1k0/casperjs/blob/master/CONTRIBUTING.md) file contents.
74+
75+
### Contributing documentation
76+
77+
CasperJS's documentation is written using the [Markdown format](http://daringfireball.net/projects/markdown/), and hosted on Github thanks to the [Github Pages Feature](http://pages.github.com/).
78+
79+
To view the source files on github, head to [the gh-pages branch](https://github.com/n1k0/casperjs/tree/gh-pages), and check the [documentation's README](https://github.com/n1k0/casperjs/tree/gh-pages#readme) for further instructions.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@ECHO OFF
2+
set CASPER_PATH=%~dp0..
3+
set CASPER_BIN=%CASPER_PATH%\bin\
4+
set ARGV=%*
5+
call phantomjs "%CASPER_BIN%bootstrap.js" --casper-path="%CASPER_PATH%" --cli %ARGV%

0 commit comments

Comments
 (0)