Skip to content

Commit

Permalink
Fix integration test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hicom150 committed Aug 19, 2019
1 parent 4834001 commit 619e524
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 619e524

Please sign in to comment.