Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Travis configuration #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
osx_image: xcode7.3
os:
- osx
node_js:
- 6
script:
- defaults write NSGlobalDomain AppleShowAllExtensions -bool true
- killall Finder
- npm test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"devDependencies": {
"capture-window": "^0.1.3",
"imgur": "^0.1.7",
"looks-same": "^2.1.0",
"mocha": "^2.2.5",
"standard": "^7.0.1"
Expand Down
12 changes: 7 additions & 5 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ var assert = require('assert')

var STEPS = 20

var CI_PREFIX = process.env.TRAVIS ? 'travis-' : ''

function runAppdmg (opts, verify, cb) {
var progressCalled = 0
var ee = appdmg(opts)
Expand Down Expand Up @@ -56,7 +58,7 @@ describe('api', function () {
var verify = {
format: 'UDZO',
title: 'Test Title',
visually: 'accepted-1.png'
visually: CI_PREFIX + 'accepted-1.png'
}

runAppdmg(opts, verify, done)
Expand All @@ -73,7 +75,7 @@ describe('api', function () {
var verify = {
format: 'UDZO',
title: 'Test Title',
visually: 'accepted-1.png'
visually: CI_PREFIX + 'accepted-1.png'
}

runAppdmg(opts, verify, done)
Expand All @@ -100,7 +102,7 @@ describe('api', function () {
var verify = {
format: 'UDZO',
title: 'Test Title',
visually: 'accepted-1.png'
visually: CI_PREFIX + 'accepted-1.png'
}

runAppdmg(opts, verify, done)
Expand Down Expand Up @@ -128,7 +130,7 @@ describe('api', function () {
var verify = {
format: 'UDRO',
title: 'Test Title',
visually: 'accepted-1.png'
visually: CI_PREFIX + 'accepted-1.png'
}

runAppdmg(opts, verify, done)
Expand All @@ -145,7 +147,7 @@ describe('api', function () {
var verify = {
format: 'UDZO',
title: 'Test Title',
visually: 'accepted-2.png'
visually: CI_PREFIX + 'accepted-2.png'
}

runAppdmg(opts, verify, done)
Expand Down
28 changes: 23 additions & 5 deletions test/lib/visually-verify-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var looksSame = require('looks-same')
var spawnSync = require('child_process').spawnSync
var captureWindow = require('capture-window')
var sizeOf = require('image-size')
var imgur = require('imgur')

var hdiutil = require('../../lib/hdiutil')

Expand Down Expand Up @@ -63,11 +64,28 @@ function captureAndSaveDiff (title, expectedPath, cb) {
looksSame.createDiff(opts, function (err, data) {
if (err) return cb(err)

temp.writeFile(data, function (err, diffPath) {
if (err) return cb(err)

cb(null, { diff: diffPath, actual: pngPath })
})
if (process.env.CI) {
imgur.uploadFile(pngPath)
.then(function (json) {
const pngUrl = json.data.link
imgur.uploadBase64(data.toString('base64'))
.then(function (json) {
setImmediate(cb, null, { diff: json.data.link, actual: pngUrl })
})
.catch(function (err) {
setImmediate(cb, err)
})
})
.catch(function (err) {
setImmediate(cb, err)
})
} else {
temp.writeFile(data, function (err, diffPath) {
if (err) return cb(err)

cb(null, { diff: diffPath, actual: pngPath })
})
}
})
})
}
Expand Down
Binary file added test/travis-accepted-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/travis-accepted-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/travis-accepted-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.