2018-05-30 08:23:57 -07:00
|
|
|
// Copyright (c) 2015-2016 Yuya Ochiai
|
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
2021-09-14 06:53:00 -07:00
|
|
|
|
2021-10-28 10:17:10 -07:00
|
|
|
'use strict';
|
|
|
|
|
2021-11-19 07:21:34 -08:00
|
|
|
const env = require('../../modules/environment');
|
2021-10-28 10:17:10 -07:00
|
|
|
|
2021-11-19 07:21:34 -08:00
|
|
|
describe('startup/app', function desc() {
|
2021-10-28 10:17:10 -07:00
|
|
|
this.timeout(30000);
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
|
|
|
env.createTestUserDataDir();
|
|
|
|
env.cleanTestConfig();
|
|
|
|
this.app = await env.getApp();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(async () => {
|
|
|
|
if (this.app) {
|
|
|
|
await this.app.close();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-11-19 07:21:34 -08:00
|
|
|
it('MM-T4399_1 should show the new server modal when no servers exist', async () => {
|
2021-10-28 10:17:10 -07:00
|
|
|
const newServerModal = this.app.windows().find((window) => window.url().includes('newServer'));
|
|
|
|
const modalTitle = await newServerModal.innerText('#newServerModal .modal-title');
|
|
|
|
modalTitle.should.equal('Add Server');
|
|
|
|
});
|
|
|
|
|
2021-11-19 07:21:34 -08:00
|
|
|
it('MM-T4399_2 should show no servers configured in dropdown when no servers exist', async () => {
|
2021-10-28 10:17:10 -07:00
|
|
|
const mainWindow = this.app.windows().find((window) => window.url().includes('index'));
|
|
|
|
const dropdownButtonText = await mainWindow.innerText('.TeamDropdownButton');
|
|
|
|
dropdownButtonText.should.equal('No servers configured');
|
|
|
|
});
|
|
|
|
|
2021-11-19 07:21:34 -08:00
|
|
|
it('MM-T4400 should be stopped when the app instance already exists', (done) => {
|
2021-10-28 10:17:10 -07:00
|
|
|
const secondApp = env.getApp();
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
secondApp.then(() => {
|
|
|
|
clearTimeout(timer);
|
|
|
|
return secondApp.close();
|
|
|
|
}).then(() => {
|
|
|
|
done(new Error('Second app instance exists'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|