Fix integration test setup
This commit is contained in:
12
package-lock.json
generated
12
package-lock.json
generated
@@ -1355,9 +1355,9 @@
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==",
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.0.tgz",
|
||||
"integrity": "sha512-Xpgy0IwHK2N01ncykXTy6FpCWuM+CJSHoPVBLyNqyrWxsedpLvwsYUhf0ME3WRFNUhos0dMamz9cOS/xRDtU5g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"base64-js": "^1.0.2",
|
||||
@@ -1365,9 +1365,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"base64-js": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
||||
"integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
|
||||
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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