Fix integration test setup
This commit is contained in:
12
package-lock.json
generated
12
package-lock.json
generated
@@ -1355,9 +1355,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"buffer": {
|
"buffer": {
|
||||||
"version": "5.2.1",
|
"version": "5.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.0.tgz",
|
||||||
"integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==",
|
"integrity": "sha512-Xpgy0IwHK2N01ncykXTy6FpCWuM+CJSHoPVBLyNqyrWxsedpLvwsYUhf0ME3WRFNUhos0dMamz9cOS/xRDtU5g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"base64-js": "^1.0.2",
|
"base64-js": "^1.0.2",
|
||||||
@@ -1365,9 +1365,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"base64-js": {
|
"base64-js": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
|
||||||
"integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
|
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,15 @@ module.exports = {
|
|||||||
// Returns a promise that resolves to a Spectron Application once the app has loaded.
|
// 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.
|
// Takes a Tape test. Makes some basic assertions to verify that the app loaded correctly.
|
||||||
function createApp (t) {
|
function createApp (t) {
|
||||||
|
const userDataDir = process.platform === 'win32'
|
||||||
|
? path.join('C:\\Windows\\Temp', 'WebTorrentTest')
|
||||||
|
: path.join('/tmp', 'WebTorrentTest')
|
||||||
|
|
||||||
return new Application({
|
return new Application({
|
||||||
path: path.join(__dirname, '..', 'node_modules', '.bin',
|
path: path.join(__dirname, '..', 'node_modules', '.bin',
|
||||||
'electron' + (process.platform === 'win32' ? '.cmd' : '')),
|
'electron' + (process.platform === 'win32' ? '.cmd' : '')),
|
||||||
args: ['-r', path.join(__dirname, 'mocks.js'), path.join(__dirname, '..')],
|
args: ['-r', path.join(__dirname, 'mocks.js'), path.join(__dirname, '..')],
|
||||||
|
chromeDriverArgs: [`--user-data-dir=${userDataDir}`],
|
||||||
env: { NODE_ENV: 'test' },
|
env: { NODE_ENV: 'test' },
|
||||||
waitTimeout: 10e3
|
waitTimeout: 10e3
|
||||||
})
|
})
|
||||||
@@ -78,6 +83,12 @@ function endTest (app, t, err) {
|
|||||||
// Otherwise, create the reference screenshot: test/screenshots/<platform>/<name>.png
|
// Otherwise, create the reference screenshot: test/screenshots/<platform>/<name>.png
|
||||||
function screenshotCreateOrCompare (app, t, name) {
|
function screenshotCreateOrCompare (app, t, name) {
|
||||||
const ssDir = path.join(__dirname, 'screenshots', process.platform)
|
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')
|
const ssPath = path.join(ssDir, name + '.png')
|
||||||
let ssBuf
|
let ssBuf
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user