From 8f633cb734d034a8a2eb5310c8bdea0df405a5ae Mon Sep 17 00:00:00 2001 From: Julian Gisser Date: Sun, 21 Aug 2016 09:49:14 +0200 Subject: [PATCH] merge with make-single-app-instance branch --- test/specs/app_test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/specs/app_test.js b/test/specs/app_test.js index a9660578..261bd896 100644 --- a/test/specs/app_test.js +++ b/test/specs/app_test.js @@ -61,4 +61,21 @@ describe('application', function() { config.version.should.equal(settings.version); }); }); + + it('should be stopped when the app instance already exists', function(done) { + this.app.start().then(() => { + const secondApp = env.getSpectronApp(); + secondApp.start().then(() => { + clearTimeout(timer); + return secondApp.stop(); + }).then(() => { + done(new Error('Second app instance exists')); + }); + // In the correct case, 'start().then' is not called. + // So need to use setTimeout in order to finish this test. + const timer = setTimeout(() => { + done(); + }, 3000); + }); + }); });