Skip to content

Commit

Permalink
casperjs, makefile, few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
voronianski committed May 2, 2013
1 parent 87efaa5 commit 9d26b3f
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,5 +1,6 @@
node_modules
examples/static-server/node_modules
examples/express-app/node_modules
test/node_modules
test/screenshots
/*.jpg
*.log
1 change: 1 addition & 0 deletions .npmignore
@@ -1,4 +1,5 @@
examples
node_modules
test
/*.jpg
*.log
7 changes: 7 additions & 0 deletions Makefile
@@ -0,0 +1,7 @@
# unit tests
test:
node_modules/.bin/mocha -R nyan ./test/spec

# phantomjs screenshots
screenshots:
casperjs ./test/runTest.js
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -83,7 +83,7 @@ Now in your main Stylus file we add ``@import`` configuration and start to use d

- ``vendors`` - list of vendors you want to use (by default includes ``webkit``, ``moz``, ``ms``, ``o`` and ``official`` which means unprefixed property);

- ``ie-support`` - set to ``true`` to enable special IE properties like ``filter: alpha(opacity = 100)`` etc.;
- ``ie-support`` - set to ``true`` to enable special IE properties like ``filter: alpha(opacity = 100)`` etc.

- ``font-stack`` - global font-family stack;

Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -12,8 +12,7 @@
"email": "dmitri.voronianski@gmail.com"
},
"scripts": {
"test": "node_modules/.bin/mocha -R nyan ./test/spec",
"screenshots": "casperjs ./test/runTest.js"
"test": "node_modules/.bin/mocha -R nyan ./test/spec"
},
"main": "index.js",
"engines": {
Expand Down
10 changes: 5 additions & 5 deletions test/README.md
Expand Up @@ -16,19 +16,19 @@ make test

##Screenshots

To test Dookie visually you'll need to start test server at first:
To test Dookie visually you'll need to install all dependencies:

```bash
node ./test/server.js
npm install
```

and in **new terminal window** to run test itself (be sure that you have [casper.js installed](http://casperjs.org/installation.html) on your machine):
and then start test server:

```bash
npm screenshots
node ./test/server.js
```

or
and in **new terminal window** run test itself (be sure that you have [casper.js installed](http://casperjs.org/installation.html) on your machine):

```bash
make screenshots
Expand Down
3 changes: 2 additions & 1 deletion test/public/css/style.css
Expand Up @@ -163,7 +163,8 @@ a img {
font-style: normal;
}
.tests {
width: 400px;
background-color: #fff;
width: 800px;
margin: 0 auto 100px;
text-align: center;
}
Expand Down
22 changes: 21 additions & 1 deletion test/runTest.js
@@ -1,3 +1,23 @@
var casper = require('casper').create();
var colorizer = require('colorizer').create('Colorizer');

var url = casper.cli.get(0) || 'localhost:8082';
var url = casper.cli.get(0) || 'http://localhost:8082';

var date = (new Date()).toString().replace(/\s/g, '-');
var filename = 'dookie-css-test-' + date + '.jpg';

casper.start(url, function () {
this.echo('test started on url -' + url, 'INFO');
});

casper.then(function () {
casper.waitForSelector('.tests', function () {
this.captureSelector(filename, '.tests');
this.echo('screenshot captured under name - ' + filename, 'COMMENT');
});
});

casper.run(function () {
this.echo('test ended', 'INFO');
this.exit();
});
3 changes: 2 additions & 1 deletion test/styl/style.styl
Expand Up @@ -5,7 +5,8 @@ base-classes()
font-face(OpenSansRegular, '../fonts')

.tests
width: 400px
background-color: #FFF
width: 800px
margin: 0 auto 100px
center()

Expand Down

0 comments on commit 9d26b3f

Please sign in to comment.