2021-11-19 07:21:34 -08:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
const env = require('../../modules/environment');
|
|
|
|
const {asyncSleep} = require('../../modules/utils');
|
|
|
|
|
|
|
|
describe('application', function desc() {
|
|
|
|
this.timeout(30000);
|
|
|
|
|
|
|
|
const config = env.demoConfig;
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
|
|
|
env.cleanDataDir();
|
|
|
|
env.createTestUserDataDir();
|
|
|
|
env.cleanTestConfig();
|
|
|
|
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
|
|
|
await asyncSleep(1000);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(async () => {
|
|
|
|
if (this.app) {
|
|
|
|
try {
|
|
|
|
await this.app.close();
|
|
|
|
// eslint-disable-next-line no-empty
|
|
|
|
} catch (err) {}
|
|
|
|
}
|
2022-07-25 06:41:19 -07:00
|
|
|
await env.clearElectronInstances();
|
2021-11-19 07:21:34 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
if (process.platform === 'win32') {
|
|
|
|
it('MM-T1304/MM-T1306 should open the app on the requested deep link', async () => {
|
|
|
|
this.app = await env.getApp(['mattermost://github.com/test/url']);
|
|
|
|
this.serverMap = await env.getServerMap(this.app);
|
2022-04-19 06:56:41 -07:00
|
|
|
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
2021-11-19 07:21:34 -08:00
|
|
|
const browserWindow = await this.app.browserWindow(mainWindow);
|
|
|
|
const webContentsId = this.serverMap[`${config.teams[1].name}___TAB_MESSAGING`].webContentsId;
|
|
|
|
const isActive = await browserWindow.evaluate((window, id) => {
|
|
|
|
return window.getBrowserViews().find((view) => view.webContents.id === id).webContents.getURL();
|
|
|
|
}, webContentsId);
|
|
|
|
isActive.should.equal('https://github.com/test/url');
|
2022-04-19 06:56:41 -07:00
|
|
|
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
|
2021-11-19 07:21:34 -08:00
|
|
|
dropdownButtonText.should.equal('github');
|
|
|
|
await this.app.close();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|