Merge lp:~stephen-stewart/ulysses/fix-jenkins-testing into lp:ulysses

Proposed by Stephen Stewart
Status: Merged
Approved by: Stephen Stewart
Approved revision: 49
Merged at revision: 45
Proposed branch: lp:~stephen-stewart/ulysses/fix-jenkins-testing
Merge into: lp:ulysses
Diff against target: 326 lines (+102/-39)
8 files modified
.bzrignore (+2/-5)
gulpfile.js (+13/-17)
package.json (+1/-1)
tarmac_verify.sh (+2/-2)
test/index.html (+3/-3)
test/visual/config/large.js (+38/-2)
test/visual/config/small.js (+43/-0)
test/visual/config/smallscreen.js (+0/-9)
To merge this branch: bzr merge lp:~stephen-stewart/ulysses/fix-jenkins-testing
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+237387@code.launchpad.net

Commit message

Use casperjs/phantomcss directly

Description of the change

Use casperjs/phantomcss directly rather than through a third party plugin, which gives us control of phantomjs version and solves a number of issues.

Casperjs error state will now be passed to gulp and any failing tests should exit correctly.

To post a comment you must log in.
49. By Stephen Stewart

remove gulp-phantomcss

Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2014-09-24 18:18:18 +0000
3+++ .bzrignore 2014-10-07 10:53:43 +0000
4@@ -1,8 +1,5 @@
5-*.swp
6 node_modules
7 bower_components
8-*.fail.png
9-*.diff.png
10-.DS_Store
11-failures
12 npm-debug.log
13+test/visual/results
14+test/visual/failures
15
16=== modified file 'gulpfile.js'
17--- gulpfile.js 2014-09-24 18:18:18 +0000
18+++ gulpfile.js 2014-10-07 10:53:43 +0000
19@@ -6,11 +6,12 @@
20 var del = require('del');
21 var fs = require('fs');
22 var gulp = require('gulp');
23+var gutil = require('gulp-util');
24 var gulpFilter = require('gulp-filter');
25-var phantomcss = require('gulp-phantomcss');
26 var pureGrids = require('rework-pure-grids');
27 var replace = require('gulp-replace');
28 var rework = require('rework');
29+var spawn = require('child_process').spawn;
30 var svgSymbols = require('gulp-svg-symbols');
31 var webserver = require('gulp-webserver');
32
33@@ -25,7 +26,6 @@
34 gulp.task('default', ['build']);
35 // to be run when newer versions of Pure or normalize are available in npm
36 gulp.task('update', ['clean', 'copy', 'grids', 'build']);
37-gulp.task('test', ['clean', 'build', 'test-small', 'test-large']);
38
39 gulp.task('watch', function() {
40 gulp.watch(paths.src + '**/*.css', ['build']);
41@@ -47,9 +47,9 @@
42 .pipe(gulp.dest(paths.dest));
43 });
44
45-gulp.task('clean', function(cb) {
46+gulp.task('clean', function() {
47 // You can use multiple globbing patterns as you would with `gulp.src`
48- del([paths.dest], cb);
49+ del([paths.dest]);
50 });
51
52 gulp.task('copy', function() {
53@@ -86,23 +86,19 @@
54 .pipe(gulp.dest('assets'));
55 });
56
57-gulp.task('test-large', function (){
58- return gulp.src('./test/visual/config/desktop.js')
59- .pipe(phantomcss({
60- screenshots: './test/visual/screenshots/desktop/'
61- }));
62-});
63+gulp.task('test', ['clean', 'build'], function (cb){
64+ var casper = spawn('./node_modules/.bin/casperjs', [
65+ 'test',
66+ '--fail-fast',
67+ 'test/visual/config/'
68+ ],
69+ {stdio: 'inherit'});
70
71-gulp.task('test-small', function (){
72- return gulp.src('./test/visual/config/smallscreen.js')
73- .pipe(phantomcss({
74- screenshots: './test/visual/screenshots/smallscreen/',
75- viewportSize: [320, 480]
76- }));
77+ casper.on('close', cb);
78 });
79
80 gulp.task('webserver', function() {
81- gulp.src('test')
82+ gulp.src('.')
83 .pipe(webserver({
84 open: true,
85 host: '0.0.0.0'
86
87=== modified file 'package.json'
88--- package.json 2014-09-24 18:18:18 +0000
89+++ package.json 2014-10-07 10:53:43 +0000
90@@ -22,7 +22,6 @@
91 "gulp-csso": "^0.2.9",
92 "gulp-filter": "^1.0.2",
93 "gulp-ignore": "^1.2.0",
94- "gulp-phantomcss": "0.0.4",
95 "gulp-replace": "^0.4.0",
96 "gulp-rework": "^1.0.2",
97 "gulp-svg-symbols": "^0.1.5",
98@@ -30,6 +29,7 @@
99 "gulp-webserver": "^0.8.1",
100 "normalize.css": "^3.0.1",
101 "phantomcss": "^0.7.2",
102+ "phantomjs": "^1.9.10",
103 "purecss": "^0.5.0",
104 "rework": "^1.0.1",
105 "rework-pure-grids": "^1.0.0"
106
107=== modified file 'tarmac_verify.sh'
108--- tarmac_verify.sh 2014-09-24 10:32:46 +0000
109+++ tarmac_verify.sh 2014-10-07 10:53:43 +0000
110@@ -1,6 +1,6 @@
111 #!/bin/bash
112-GULP=./node_modules/.bin/gulp
113+PATH=$PATH:./node_modules/.bin
114
115 set -e
116 npm --silent i
117-$GULP --no-color test
118+gulp --no-color test
119
120=== modified file 'test/index.html'
121--- test/index.html 2014-09-24 16:24:42 +0000
122+++ test/index.html 2014-10-07 10:53:43 +0000
123@@ -4,9 +4,9 @@
124 <title>Ulysses CSS Test Page</title>
125
126 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
127-<link rel="stylesheet" href="css/ulysses.css">
128-<link rel="stylesheet" media="(max-width: 480px)" href="css/navbar-small.css">
129-<link rel="stylesheet" media="(max-width: 480px)" href="css/searchbar-small.css">
130+<link rel="stylesheet" href="../public/ulysses.css">
131+<link rel="stylesheet" media="(max-width: 480px)" href="../public/navbar-small.css">
132+<link rel="stylesheet" media="(max-width: 480px)" href="../public/searchbar-small.css">
133
134 <!--
135
136
137=== renamed file 'test/visual/config/desktop.js' => 'test/visual/config/large.js'
138--- test/visual/config/desktop.js 2014-09-24 18:18:18 +0000
139+++ test/visual/config/large.js 2014-10-07 10:53:43 +0000
140@@ -1,5 +1,24 @@
141-casper.start( 'http://0.0.0.0:8000/' );
142-casper.then(function(){
143+var phantomcss = require('./../../../node_modules/phantomcss/phantomcss.js');
144+
145+phantomcss.init({
146+ libraryRoot: './node_modules/phantomcss',
147+ screenshotRoot: './test/visual/screenshots/large',
148+ failedComparisonsRoot: './test/visual/failures/large',
149+ comparisonResultRoot: './test/visual/results/large',
150+ errorType: 'movement',
151+ fileNameGetter: function(root,filename){
152+ var name = root+'/'+filename.toLowerCase().replace(/ /g,'_');
153+ if(fs.isFile(name+'.png')){
154+ return name+'.diff.png';
155+ } else {
156+ return name+'.png';
157+ }
158+ },
159+});
160+
161+casper.start( './test/index.html' );
162+
163+casper.viewport(1024, 768, function(){
164 // buttons
165 phantomcss.screenshot('[data-qa="default-button"]', 'Default Button');
166 phantomcss.screenshot('[data-qa="primary-button"]', 'Primary Button');
167@@ -31,3 +50,20 @@
168 // phantomcss.screenshot('[data-qa="notifications"]', 'notifications');
169 //
170 });
171+
172+casper.then( function now_check_the_screenshots(){
173+ // compare screenshots
174+ phantomcss.compareAll();
175+});
176+
177+casper.then( function end_it(){
178+ casper.test.done();
179+});
180+
181+/*
182+Casper runs tests
183+*/
184+casper.run(function(){
185+ console.log('\nTHE END.');
186+ phantom.exit(phantomcss.getExitStatus());
187+});
188
189=== added file 'test/visual/config/small.js'
190--- test/visual/config/small.js 1970-01-01 00:00:00 +0000
191+++ test/visual/config/small.js 2014-10-07 10:53:43 +0000
192@@ -0,0 +1,43 @@
193+var phantomcss = require('./../../../node_modules/phantomcss/phantomcss.js');
194+
195+phantomcss.init({
196+ libraryRoot: './node_modules/phantomcss',
197+ screenshotRoot: './test/visual/screenshots/small',
198+ failedComparisonsRoot: './test/visual/failures/small',
199+ comparisonResultRoot: './test/visual/results/small',
200+ errorType: 'movement',
201+ fileNameGetter: function(root,filename){
202+ var name = root+'/'+filename.toLowerCase().replace(/ /g,'_');
203+ if(fs.isFile(name+'.png')){
204+ return name+'.diff.png';
205+ } else {
206+ return name+'.png';
207+ }
208+ },
209+});
210+
211+casper.start( './test/index.html' );
212+
213+casper.viewport(320, 480, function(){
214+ // navbars, small screen
215+ phantomcss.screenshot('[data-qa="navbar-simple"]', 'Simple Navbar');
216+ phantomcss.screenshot('[data-qa="navbar-invert"]', 'Invert Navbar');
217+ phantomcss.screenshot('[data-qa="navbar-full"]', 'Full Navbar');
218+});
219+
220+casper.then( function now_check_the_screenshots(){
221+ // compare screenshots
222+ phantomcss.compareAll();
223+});
224+
225+casper.then( function end_it(){
226+ casper.test.done();
227+});
228+
229+/*
230+Casper runs tests
231+*/
232+casper.run(function(){
233+ console.log('\nTHE END.');
234+ phantom.exit(phantomcss.getExitStatus());
235+});
236
237=== removed file 'test/visual/config/smallscreen.js'
238--- test/visual/config/smallscreen.js 2014-09-24 10:17:01 +0000
239+++ test/visual/config/smallscreen.js 1970-01-01 00:00:00 +0000
240@@ -1,9 +0,0 @@
241-casper.start( './test/index.html' );
242-
243-casper.then(function(){
244- // navbars, small screen
245- phantomcss.screenshot('[data-qa="navbar-simple"]', 'Simple Navbar');
246- phantomcss.screenshot('[data-qa="navbar-invert"]', 'Invert Navbar');
247- phantomcss.screenshot('[data-qa="navbar-full"]', 'Full Navbar');
248-
249-});
250
251=== removed directory 'test/visual/screenshots/desktop'
252=== removed file 'test/visual/screenshots/desktop/Button Group_3.png'
253Binary files test/visual/screenshots/desktop/Button Group_3.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Button Group_3.png 1970-01-01 00:00:00 +0000 differ
254=== removed file 'test/visual/screenshots/desktop/Button Toolbar_4.png'
255Binary files test/visual/screenshots/desktop/Button Toolbar_4.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Button Toolbar_4.png 1970-01-01 00:00:00 +0000 differ
256=== removed file 'test/visual/screenshots/desktop/Checkboxes and radios_13.png'
257Binary files test/visual/screenshots/desktop/Checkboxes and radios_13.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/Checkboxes and radios_13.png 1970-01-01 00:00:00 +0000 differ
258=== removed file 'test/visual/screenshots/desktop/Default Button_0.png'
259Binary files test/visual/screenshots/desktop/Default Button_0.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Default Button_0.png 1970-01-01 00:00:00 +0000 differ
260=== removed file 'test/visual/screenshots/desktop/Default form_11.png'
261Binary files test/visual/screenshots/desktop/Default form_11.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Default form_11.png 1970-01-01 00:00:00 +0000 differ
262=== removed file 'test/visual/screenshots/desktop/Full Navbar_8.png'
263Binary files test/visual/screenshots/desktop/Full Navbar_8.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/Full Navbar_8.png 1970-01-01 00:00:00 +0000 differ
264=== removed file 'test/visual/screenshots/desktop/Headlines_5.png'
265Binary files test/visual/screenshots/desktop/Headlines_5.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/Headlines_5.png 1970-01-01 00:00:00 +0000 differ
266=== removed file 'test/visual/screenshots/desktop/Inline form_12.png'
267Binary files test/visual/screenshots/desktop/Inline form_12.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Inline form_12.png 1970-01-01 00:00:00 +0000 differ
268=== removed file 'test/visual/screenshots/desktop/Invert Navbar_7.png'
269Binary files test/visual/screenshots/desktop/Invert Navbar_7.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/Invert Navbar_7.png 1970-01-01 00:00:00 +0000 differ
270=== removed file 'test/visual/screenshots/desktop/Navbar with button_9.png'
271Binary files test/visual/screenshots/desktop/Navbar with button_9.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Navbar with button_9.png 1970-01-01 00:00:00 +0000 differ
272=== removed file 'test/visual/screenshots/desktop/Navbar with secondary text_10.png'
273Binary files test/visual/screenshots/desktop/Navbar with secondary text_10.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/Navbar with secondary text_10.png 1970-01-01 00:00:00 +0000 differ
274=== removed file 'test/visual/screenshots/desktop/Primary Button_1.png'
275Binary files test/visual/screenshots/desktop/Primary Button_1.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Primary Button_1.png 1970-01-01 00:00:00 +0000 differ
276=== removed file 'test/visual/screenshots/desktop/Simple Navbar_6.png'
277Binary files test/visual/screenshots/desktop/Simple Navbar_6.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/Simple Navbar_6.png 1970-01-01 00:00:00 +0000 differ
278=== removed file 'test/visual/screenshots/desktop/Tertiary Button_2.png'
279Binary files test/visual/screenshots/desktop/Tertiary Button_2.png 2014-09-24 18:18:18 +0000 and test/visual/screenshots/desktop/Tertiary Button_2.png 1970-01-01 00:00:00 +0000 differ
280=== removed file 'test/visual/screenshots/desktop/grids_14.png'
281Binary files test/visual/screenshots/desktop/grids_14.png 2014-04-03 15:40:39 +0000 and test/visual/screenshots/desktop/grids_14.png 1970-01-01 00:00:00 +0000 differ
282=== added directory 'test/visual/screenshots/large'
283=== added file 'test/visual/screenshots/large/button_group.png'
284Binary files test/visual/screenshots/large/button_group.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/button_group.png 2014-10-07 10:53:43 +0000 differ
285=== added file 'test/visual/screenshots/large/button_toolbar.png'
286Binary files test/visual/screenshots/large/button_toolbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/button_toolbar.png 2014-10-07 10:53:43 +0000 differ
287=== added file 'test/visual/screenshots/large/checkboxes_and_radios.png'
288Binary files test/visual/screenshots/large/checkboxes_and_radios.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/checkboxes_and_radios.png 2014-10-07 10:53:43 +0000 differ
289=== added file 'test/visual/screenshots/large/default_button.png'
290Binary files test/visual/screenshots/large/default_button.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/default_button.png 2014-10-07 10:53:43 +0000 differ
291=== added file 'test/visual/screenshots/large/default_form.png'
292Binary files test/visual/screenshots/large/default_form.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/default_form.png 2014-10-07 10:53:43 +0000 differ
293=== added file 'test/visual/screenshots/large/full_navbar.png'
294Binary files test/visual/screenshots/large/full_navbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/full_navbar.png 2014-10-07 10:53:43 +0000 differ
295=== added file 'test/visual/screenshots/large/grids.png'
296Binary files test/visual/screenshots/large/grids.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/grids.png 2014-10-07 10:53:43 +0000 differ
297=== added file 'test/visual/screenshots/large/headlines.png'
298Binary files test/visual/screenshots/large/headlines.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/headlines.png 2014-10-07 10:53:43 +0000 differ
299=== added file 'test/visual/screenshots/large/inline_form.png'
300Binary files test/visual/screenshots/large/inline_form.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/inline_form.png 2014-10-07 10:53:43 +0000 differ
301=== added file 'test/visual/screenshots/large/invert_navbar.png'
302Binary files test/visual/screenshots/large/invert_navbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/invert_navbar.png 2014-10-07 10:53:43 +0000 differ
303=== added file 'test/visual/screenshots/large/navbar_with_button.png'
304Binary files test/visual/screenshots/large/navbar_with_button.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/navbar_with_button.png 2014-10-07 10:53:43 +0000 differ
305=== added file 'test/visual/screenshots/large/navbar_with_secondary_text.png'
306Binary files test/visual/screenshots/large/navbar_with_secondary_text.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/navbar_with_secondary_text.png 2014-10-07 10:53:43 +0000 differ
307=== added file 'test/visual/screenshots/large/primary_button.png'
308Binary files test/visual/screenshots/large/primary_button.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/primary_button.png 2014-10-07 10:53:43 +0000 differ
309=== added file 'test/visual/screenshots/large/simple_navbar.png'
310Binary files test/visual/screenshots/large/simple_navbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/simple_navbar.png 2014-10-07 10:53:43 +0000 differ
311=== added file 'test/visual/screenshots/large/tertiary_button.png'
312Binary files test/visual/screenshots/large/tertiary_button.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/large/tertiary_button.png 2014-10-07 10:53:43 +0000 differ
313=== added directory 'test/visual/screenshots/small'
314=== added file 'test/visual/screenshots/small/full_navbar.png'
315Binary files test/visual/screenshots/small/full_navbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/small/full_navbar.png 2014-10-07 10:53:43 +0000 differ
316=== added file 'test/visual/screenshots/small/invert_navbar.png'
317Binary files test/visual/screenshots/small/invert_navbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/small/invert_navbar.png 2014-10-07 10:53:43 +0000 differ
318=== added file 'test/visual/screenshots/small/simple_navbar.png'
319Binary files test/visual/screenshots/small/simple_navbar.png 1970-01-01 00:00:00 +0000 and test/visual/screenshots/small/simple_navbar.png 2014-10-07 10:53:43 +0000 differ
320=== removed directory 'test/visual/screenshots/smallscreen'
321=== removed file 'test/visual/screenshots/smallscreen/Full Navbar_2.png'
322Binary files test/visual/screenshots/smallscreen/Full Navbar_2.png 2014-05-12 08:57:40 +0000 and test/visual/screenshots/smallscreen/Full Navbar_2.png 1970-01-01 00:00:00 +0000 differ
323=== removed file 'test/visual/screenshots/smallscreen/Invert Navbar_1.png'
324Binary files test/visual/screenshots/smallscreen/Invert Navbar_1.png 2014-05-12 08:57:40 +0000 and test/visual/screenshots/smallscreen/Invert Navbar_1.png 1970-01-01 00:00:00 +0000 differ
325=== removed file 'test/visual/screenshots/smallscreen/Simple Navbar_0.png'
326Binary files test/visual/screenshots/smallscreen/Simple Navbar_0.png 2014-05-12 08:57:40 +0000 and test/visual/screenshots/smallscreen/Simple Navbar_0.png 1970-01-01 00:00:00 +0000 differ

Subscribers

People subscribed via source and target branches