This repository was archived by the owner on Sep 21, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathtester.js
More file actions
50 lines (40 loc) · 1.31 KB
/
Copy pathtester.js
File metadata and controls
50 lines (40 loc) · 1.31 KB
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
<
6351
div data-line-number="39" class="react-line-number react-code-text" style="padding-right:16px">3940
41
42
43
44
45
46
47
48
49
50
'use strict';
var inherit = require('inherit'),
q = require('q'),
temp = require('temp'),
Runner = require('./runner'),
Image = require('./image'),
mktemp = q.nbind(temp.mkdir, temp);
temp.track();
module.exports = inherit(Runner, {
_prepare: function() {
var _this = this;
return mktemp('gemini').then(function(dir) {
_this._tempDir = dir;
});
},
_processCapture: function(capture) {
var refPath = this.config.getScreenshotPath(
capture.suite,
capture.state.name,
capture.browser.fullName),
_this = this;
return capture.image.save(this._tempPath())
.then(function(path) {
return [path, Image.compare(path, refPath)];
})
.spread(function(currentPath, isEqual) {
_this.emit('endTest', {
suiteName: capture.suite.name,
stateName: capture.state.name,
equal: isEqual,
referencePath: refPath,
currentPath: currentPath,
browserName: capture.browser.fullName
});
});
},
_tempPath: function() {
return temp.path({dir: this._tempDir, suffix: '.png'});
},
});