diff --git a/core/util/compare.js b/core/util/compare.js index 88d919f08..37dbb5ca8 100644 --- a/core/util/compare.js +++ b/core/util/compare.js @@ -69,8 +69,8 @@ module.exports = function (config) { return map(compareConfig.testPairs, function (pair) { var Test = report.addTest(pair); - var referencePath = path.join(config.projectPath, pair.reference); - var testPath = path.join(config.projectPath, pair.test); + var referencePath = path.resolve(config.projectPath, pair.reference); + var testPath = path.resolve(config.projectPath, pair.test); return compareImage(referencePath, testPath, config.resembleOutputOptions) .then(function logCompareResult (data) { diff --git a/examples/absolutePaths/.gitignore b/examples/absolutePaths/.gitignore new file mode 100644 index 000000000..37a9fae63 --- /dev/null +++ b/examples/absolutePaths/.gitignore @@ -0,0 +1 @@ +/backstop_data/ diff --git a/examples/absolutePaths/README.md b/examples/absolutePaths/README.md new file mode 100644 index 000000000..78d241457 --- /dev/null +++ b/examples/absolutePaths/README.md @@ -0,0 +1,10 @@ +# Backstop Absolute Paths Example + +You can run this example by executing the following commands: + +1. `npm install` +2. `npm start` + +## License + +MIT diff --git a/examples/absolutePaths/backstop.js b/examples/absolutePaths/backstop.js new file mode 100644 index 000000000..192fdbf1c --- /dev/null +++ b/examples/absolutePaths/backstop.js @@ -0,0 +1,27 @@ +const path = require('path'); + +module.exports = { + id: 'Absolute Paths Example', + viewports: [ + { + name: 'phone', + width: 320, + height: 480 + } + ], + scenarios: [ + { + label: 'Absolute Paths Example', + url: 'http://localhost:8000/', + selectors: [ + '.title' + ] + } + ], + paths: { + bitmaps_reference: path.resolve(__dirname, 'backstop_data/bitmaps_reference'), + bitmaps_test: path.resolve(__dirname, 'backstop_data/bitmaps_test') + }, + engine: 'phantomjs', + report: ['browser'] +}; diff --git a/examples/absolutePaths/package.json b/examples/absolutePaths/package.json new file mode 100644 index 000000000..192733303 --- /dev/null +++ b/examples/absolutePaths/package.json @@ -0,0 +1,17 @@ +{ + "name": "absolute-paths-example", + "version": "1.0.0", + "private": true, + "author": "katashin", + "license": "MIT", + "scripts": { + "start": "run-p serve test", + "test": "backstop reference --config=backstop.js && backstop test --config=backstop.js", + "serve": "lite-server -c server.json" + }, + "dependencies": { + "backstopjs": "^2.6.14", + "lite-server": "^2.3.0", + "npm-run-all": "^4.0.2" + } +} diff --git a/examples/absolutePaths/server.json b/examples/absolutePaths/server.json new file mode 100644 index 000000000..1155a48ce --- /dev/null +++ b/examples/absolutePaths/server.json @@ -0,0 +1,11 @@ +{ + "port": "8000", + "open": false, + "ui": false, + "ghostMode": false, + "notify": false, + "logLevel": "silent", + "server": { + "baseDir": "./static" + } +} diff --git a/examples/absolutePaths/static/index.html b/examples/absolutePaths/static/index.html new file mode 100644 index 000000000..b954050f2 --- /dev/null +++ b/examples/absolutePaths/static/index.html @@ -0,0 +1,12 @@ + + + + + + + Absolute Paths Example + + +

Hello

+ +