-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgulpfile.js
97 lines (88 loc) · 2.86 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var gulp = require("gulp");
var sc5StyleguideGemini = require('./');
var styleguide = require('sc5-styleguide');
var concat = require('gulp-concat');
var minimist = require('minimist');
var testDirPath = './tests/tmp';
var styleguideSource = './tests/data/*.css';
var styleguidePath = './tests/data/styleguide';
gulp.task('styleguide:generate', function() {
return gulp.src(styleguideSource)
.pipe(styleguide.generate({
title: 'SC5 Styleguide',
server: true,
rootPath: styleguidePath,
overviewPath: 'README.md'
}))
.pipe(gulp.dest(styleguidePath));
});
gulp.task('styleguide:applystyles', function() {
return gulp.src(styleguideSource)
.pipe(concat('all.css'))
.pipe(styleguide.applyStyles())
.pipe(gulp.dest(styleguidePath));
});
gulp.task('styleguide', ['styleguide:generate', 'styleguide:applystyles']);
var knownOptions = {
'string': 'section',
'default': { 'section': false }
}
/* test server options 'phantom' or 'selenium' */
var testServer = 'phantom'; // default is phantom
var options = minimist(process.argv.slice(2), knownOptions);
gulp.task("test:visual:update", function() {
gulp.src(styleguidePath, { read: false })
.pipe(sc5StyleguideGemini.gather({
configDir: testDirPath + '/config', // Path to configuration and tests
excludePages: [
'2.2.1', // Back icon is not shown in prod
'6.1-2', // picture is not loaded in prod
],
gridScreenshotsDir: testDirPath + '/grid-screenshots',
rootUrl: 'http://localhost:3000/',
sections: options.section,
testServer: testServer,
coreTest: '../../custom-tests/core-test.js',
customTests: {
'2.1': '../../custom-tests/custom-test.js'
},
geminiOptions: {
browsers: {
"chrome-latest": {
desiredCapabilities: {
browserName: 'chrome',
version: '37.0'
}
}
},
windowSize: '300x400'
}
}))
.pipe(gulp.dest(testDirPath + '/config')) // Path to configuration and tests
});
gulp.task("test:visual", function(done){
gulp.src(styleguidePath, { read: false })
.pipe(sc5StyleguideGemini.test({
configDir: testDirPath + '/config', // Path to configuration and tests
gridScreenshotsDir: testDirPath + '/grid-screenshots',
rootUrl: 'http://localhost:3000/',
sections: options.section,
testServer: testServer,
coreTest: '../../custom-tests/core-test.js',
customTests: {
'2.1': '../../custom-tests/custom-test.js'
},
geminiOptions: {
browsers: {
"chrome-latest": {
desiredCapabilities: {
browserName: 'chrome',
version: '37.0'
}
}
},
windowSize: '300x400'
}
}));
});
gulp.task("test", ["styleguide", "test:visual:update", "test:visual"]);