Fix integration test setup
This commit is contained in:
@@ -28,10 +28,15 @@ module.exports = {
|
||||
// Returns a promise that resolves to a Spectron Application once the app has loaded.
|
||||
// Takes a Tape test. Makes some basic assertions to verify that the app loaded correctly.
|
||||
function createApp (t) {
|
||||
const userDataDir = process.platform === 'win32'
|
||||
? path.join('C:\\Windows\\Temp', 'WebTorrentTest')
|
||||
: path.join('/tmp', 'WebTorrentTest')
|
||||
|
||||
return new Application({
|
||||
path: path.join(__dirname, '..', 'node_modules', '.bin',
|
||||
'electron' + (process.platform === 'win32' ? '.cmd' : '')),
|
||||
args: ['-r', path.join(__dirname, 'mocks.js'), path.join(__dirname, '..')],
|
||||
chromeDriverArgs: [`--user-data-dir=${userDataDir}`],
|
||||
env: { NODE_ENV: 'test' },
|
||||
waitTimeout: 10e3
|
||||
})
|
||||
@@ -78,6 +83,12 @@ function endTest (app, t, err) {
|
||||
// Otherwise, create the reference screenshot: test/screenshots/<platform>/<name>.png
|
||||
function screenshotCreateOrCompare (app, t, name) {
|
||||
const ssDir = path.join(__dirname, 'screenshots', process.platform)
|
||||
|
||||
// check that path exists otherwise create it
|
||||
if (!fs.existsSync(ssDir)) {
|
||||
fs.mkdirSync(ssDir)
|
||||
}
|
||||
|
||||
const ssPath = path.join(ssDir, name + '.png')
|
||||
let ssBuf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user