From 6702f411436930aa038c057ad3b2d192851e1239 Mon Sep 17 00:00:00 2001 From: Md_ZubairAhmed Date: Mon, 31 Jan 2022 21:09:49 +0530 Subject: [PATCH] test: MM-T806 Exit in the Menu Bar (#1980) --- e2e/specs/menu_bar/file_menu.test.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/e2e/specs/menu_bar/file_menu.test.js b/e2e/specs/menu_bar/file_menu.test.js index 33f0ad55..41cc1b96 100644 --- a/e2e/specs/menu_bar/file_menu.test.js +++ b/e2e/specs/menu_bar/file_menu.test.js @@ -14,16 +14,20 @@ describe('file_menu/dropdown', function desc() { const config = env.demoConfig; + let skipAfterEach = false; + beforeEach(async () => { env.createTestUserDataDir(); env.cleanTestConfig(); fs.writeFileSync(env.configFilePath, JSON.stringify(config)); await asyncSleep(1000); this.app = await env.getApp(); + + skipAfterEach = false; }); afterEach(async () => { - if (this.app) { + if (this.app && skipAfterEach === false) { await this.app.close(); } }); @@ -80,4 +84,21 @@ describe('file_menu/dropdown', function desc() { settingsWindowFromMenu.should.not.be.null; } }); + + it('MM-T806 Exit in the Menu Bar', () => { + const mainWindow = this.app.windows().find((window) => window.url().includes('index')); + mainWindow.should.not.be.null; + + if (process.platform === 'darwin') { + robot.keyTap('q', ['command']); + } + + if (process.platform === 'linux' || process.platform === 'win32') { + robot.keyTap('q', ['control']); + } + + this.app.windows().find((window) => window.url().should.not.include('index')); + + skipAfterEach = true; // Need to skip closing in aftereach as apps execution context is destroyed above + }); });