Clean up test userData before each test
This commit is contained in:
parent
3613f70a72
commit
65286a6454
|
@ -39,6 +39,12 @@ module.exports = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createTestUserDataDir() {
|
||||||
|
if (!fs.existsSync(userDataDir)) {
|
||||||
|
fs.mkdirSync(userDataDir);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getSpectronApp() {
|
getSpectronApp() {
|
||||||
return new Application({
|
return new Application({
|
||||||
path: electronBinaryPath,
|
path: electronBinaryPath,
|
||||||
|
|
|
@ -8,17 +8,15 @@ describe('application', function desc() {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
env.createTestUserDataDir();
|
||||||
env.cleanTestConfig();
|
env.cleanTestConfig();
|
||||||
this.app = env.getSpectronApp();
|
this.app = env.getSpectronApp();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
if (this.app && this.app.isRunning()) {
|
if (this.app && this.app.isRunning()) {
|
||||||
return this.app.stop().then(() => {
|
return this.app.stop();
|
||||||
env.cleanTestConfig();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
env.cleanTestConfig();
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue