[MM-40144] Restructure tests, add test case numbers, some cleanup (#1864)

* [MM-40144] Restructure tests, add test case numbers, some cleanup

* Fix a test
This commit is contained in:
Devin Binnie
2021-11-19 10:21:34 -05:00
committed by GitHub
parent 113d87fe04
commit 4fa89a5fce
21 changed files with 963 additions and 1229 deletions

View File

@@ -0,0 +1,49 @@
// 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) {}
}
});
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);
const mainWindow = await this.app.firstWindow();
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');
const mainView = this.app.windows().find((window) => window.url().includes('index'));
const dropdownButtonText = await mainView.innerText('.TeamDropdownButton');
dropdownButtonText.should.equal('github');
await this.app.close();
});
}
});