Skip to content

Commit 384adf2

Browse files
committed
use docker container to run phantomcss/casperjs
1 parent cca8918 commit 384adf2

File tree

8 files changed

+10
-47
lines changed

8 files changed

+10
-47
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: d
2-
sudo: false
2+
services:
3+
- docker
34
addons:
45
apt:
56
packages:
-57.1 KB
Loading

test/screenshots/code_example.png

-38.9 KB
Loading
-10.7 KB
Loading
-7.2 KB
Loading

test/test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
var fs = require('fs'),
2+
system = require('system'),
23
phantomcss = require(fs.workingDirectory + '/node_modules/phantomcss/phantomcss.js');
34

5+
var listen_addr = system.env['LISTEN_ADDR'];
6+
47
casper.test.begin('ddox visual test', function(test) {
58
var options = {
69
rebase: casper.cli.get( "rebase" ),
@@ -15,7 +18,7 @@ casper.test.begin('ddox visual test', function(test) {
1518
var tests = ['declaration_prototype', 'function_parameters', 'code_example', 'class_main_contents'];
1619

1720
casper
18-
.start('http://localhost:8080/vibe.web.rest/registerRestInterface')
21+
.start(listen_addr + '/vibe.web.rest/registerRestInterface')
1922
.viewport(1024, 768)
2023
.then(function() {
2124
phantomcss.screenshot('#main-contents > div:nth-child(3)', tests[0]);
@@ -26,7 +29,7 @@ casper.test.begin('ddox visual test', function(test) {
2629
.then(function() {
2730
phantomcss.screenshot('#main-contents > section:nth-child(7)', tests[2]);
2831
})
29-
.thenOpen('http://localhost:8080/vibe.web.rest/RestInterfaceClient')
32+
.thenOpen(listen_addr + '/vibe.web.rest/RestInterfaceClient')
3033
.then(function() {
3134
phantomcss.screenshot('#main-contents', tests[3]);
3235
});

tests/issue116_inherit_macros/test.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

travis-ci.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ PID=$!
2323
cleanup() { kill $PID; }
2424
trap cleanup EXIT
2525

26-
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
27-
tar -C $HOME -jxf phantomjs-2.1.1-linux-x86_64.tar.bz2
28-
export PATH="$HOME/phantomjs-2.1.1-linux-x86_64/bin/:$PATH"
2926

30-
npm install phantomcss -q
31-
if ! ./node_modules/phantomcss/node_modules/.bin/casperjs test test/test.js ; then
27+
bridgeip=$(ip -4 addr show dev docker0 | sed -n 's|.*inet \(.*\)/.*|\1|p')
28+
if ! docker run --rm --env LISTEN_ADDR="http://$bridgeip:8080" \
29+
--volume=$PWD/test:/usr/src/app/test martinnowak/phantomcss-tester test test/test.js; then
3230
# upload failing screenshots
3331
cd test/screenshots
3432
for img in *.{diff,fail}.png; do

0 commit comments

Comments
 (0)