[MM-38503] Upgrade to Electron v14 (#1734)
* [MM-38503] Upgrade to Electron v14 * Temporarily comment out tests that use spectron * One more
This commit is contained in:
parent
375da5bdb3
commit
980eed8d8d
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -65,7 +65,7 @@
|
|||
"cross-env": "^5.2.0",
|
||||
"css-loader": "^1.0.1",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "13.2.1",
|
||||
"electron": "14.0.0",
|
||||
"electron-builder": "22.11.7",
|
||||
"electron-connect": "^0.6.3",
|
||||
"electron-mocha": "^10.1.0",
|
||||
|
@ -12430,9 +12430,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/electron": {
|
||||
"version": "13.2.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-13.2.1.tgz",
|
||||
"integrity": "sha512-/K0Uw+o3+phbHtrVL6qDFVJqmeRF6EIPwVeUHEH5R8JNy13f4X3RouKjQzVyY/Os8fEqYHGFONWhD6q6g750HQ==",
|
||||
"version": "14.0.0",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-14.0.0.tgz",
|
||||
"integrity": "sha512-O6EI7L1BPIrTpEIFefjjmdbmSn9LtE4mmrv4dfpV4Mqaa8uKuNYQogwZPEvSwaBexb69eb1LQ25n+f+kBcjiRQ==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
|
@ -38103,9 +38103,9 @@
|
|||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "13.2.1",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-13.2.1.tgz",
|
||||
"integrity": "sha512-/K0Uw+o3+phbHtrVL6qDFVJqmeRF6EIPwVeUHEH5R8JNy13f4X3RouKjQzVyY/Os8fEqYHGFONWhD6q6g750HQ==",
|
||||
"version": "14.0.0",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-14.0.0.tgz",
|
||||
"integrity": "sha512-O6EI7L1BPIrTpEIFefjjmdbmSn9LtE4mmrv4dfpV4Mqaa8uKuNYQogwZPEvSwaBexb69eb1LQ25n+f+kBcjiRQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@electron/get": "^1.0.1",
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
"cross-env": "^5.2.0",
|
||||
"css-loader": "^1.0.1",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "13.2.1",
|
||||
"electron": "14.0.0",
|
||||
"electron-builder": "22.11.7",
|
||||
"electron-connect": "^0.6.3",
|
||||
"electron-mocha": "^10.1.0",
|
||||
|
|
|
@ -76,13 +76,13 @@ export class MattermostView extends EventEmitter {
|
|||
const preload = getLocalPreload('preload.js');
|
||||
this.options = Object.assign({}, options);
|
||||
this.options.webPreferences = {
|
||||
nativeWindowOpen: true,
|
||||
contextIsolation: process.env.NODE_ENV !== 'test',
|
||||
preload,
|
||||
additionalArguments: [
|
||||
`version=${app.getVersion()}`,
|
||||
`appName=${app.name}`,
|
||||
],
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
nodeIntegration: process.env.NODE_ENV === 'test',
|
||||
...options.webPreferences,
|
||||
};
|
||||
|
|
|
@ -31,10 +31,10 @@ export class ModalView<T, T2> {
|
|||
this.data = data;
|
||||
log.info(`preloading with ${preload}`);
|
||||
this.view = new BrowserView({webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
contextIsolation: process.env.NODE_ENV !== 'test',
|
||||
preload,
|
||||
nodeIntegration: process.env.NODE_ENV === 'test',
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
}});
|
||||
this.onReject = onReject;
|
||||
this.onResolve = onResolve;
|
||||
|
|
|
@ -45,10 +45,10 @@ export default class TeamDropdownView {
|
|||
|
||||
const preload = getLocalPreload('dropdown.js');
|
||||
this.view = new BrowserView({webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
contextIsolation: process.env.NODE_ENV !== 'test',
|
||||
preload,
|
||||
nodeIntegration: process.env.NODE_ENV === 'test',
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
}});
|
||||
|
||||
this.view.webContents.loadURL(getLocalURLString('dropdown.html'));
|
||||
|
|
|
@ -276,9 +276,9 @@ export class ViewManager {
|
|||
const urlString = typeof url === 'string' ? url : url.toString();
|
||||
const urlView = new BrowserView({
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
contextIsolation: process.env.NODE_ENV !== 'test',
|
||||
nodeIntegration: process.env.NODE_ENV === 'test',
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
}});
|
||||
const query = new Map([['url', urlString]]);
|
||||
const localURL = getLocalURLString('urlView.html', query);
|
||||
|
@ -322,7 +322,7 @@ export class ViewManager {
|
|||
createLoadingScreen = () => {
|
||||
const preload = getLocalPreload('loadingScreenPreload.js');
|
||||
this.loadingScreen = new BrowserView({webPreferences: {
|
||||
contextIsolation: true,
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
}});
|
||||
const localURL = getLocalURLString('loadingScreen.html');
|
||||
|
|
|
@ -170,7 +170,6 @@ const generateNewWindowListener = (getServersFunction: () => TeamWithTabs[], spe
|
|||
nodeIntegration: process.env.NODE_ENV === 'test',
|
||||
contextIsolation: process.env.NODE_ENV !== 'test',
|
||||
spellcheck: (typeof spellcheck === 'undefined' ? true : spellcheck),
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
},
|
||||
});
|
||||
popupWindow.webContents.on('new-window', denyNewWindow);
|
||||
|
|
|
@ -70,12 +70,12 @@ function createMainWindow(config: CombinedConfig, options: {linuxAppIcon: string
|
|||
trafficLightPosition: {x: 12, y: 12},
|
||||
backgroundColor: '#fff', // prevents blurry text: https://electronjs.org/docs/faq#the-font-looks-blurry-what-is-this-and-what-can-i-do
|
||||
webPreferences: {
|
||||
nativeWindowOpen: true,
|
||||
nodeIntegration: process.env.NODE_ENV === 'test',
|
||||
contextIsolation: process.env.NODE_ENV !== 'test',
|
||||
disableBlinkFeatures: 'Auxclick',
|
||||
preload,
|
||||
spellcheck,
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -16,11 +16,9 @@ export function createSettingsWindow(mainWindow: BrowserWindow, config: Combined
|
|||
title: 'Desktop App Settings',
|
||||
fullscreen: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
nativeWindowOpen: true,
|
||||
preload,
|
||||
spellcheck,
|
||||
enableRemoteModule: process.env.NODE_ENV === 'test',
|
||||
}});
|
||||
|
||||
const contextMenu = new ContextMenu({}, settingsWindow);
|
||||
|
|
|
@ -2,159 +2,161 @@
|
|||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import url from 'url';
|
||||
// TODO: Commented out for now since remote is removed, will be changed with the autoupdater changes anyway.
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import {remote} from 'electron';
|
||||
// import url from 'url';
|
||||
|
||||
import UpdaterPage from './components/UpdaterPage';
|
||||
// import React from 'react';
|
||||
// import ReactDOM from 'react-dom';
|
||||
// //import {remote} from 'electron';
|
||||
|
||||
const thisURL = url.parse(location.href, true);
|
||||
const notifyOnly = thisURL.query.notifyOnly === 'true';
|
||||
// import UpdaterPage from './components/UpdaterPage';
|
||||
|
||||
type Props = {
|
||||
notifyOnly: boolean;
|
||||
initialState: State;
|
||||
};
|
||||
// const thisURL = url.parse(location.href, true);
|
||||
// const notifyOnly = thisURL.query.notifyOnly === 'true';
|
||||
|
||||
type State = {
|
||||
// type Props = {
|
||||
// notifyOnly: boolean;
|
||||
// initialState: State;
|
||||
// };
|
||||
|
||||
}
|
||||
// type State = {
|
||||
|
||||
class UpdaterPageContainer extends React.PureComponent<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = props.initialState;
|
||||
}
|
||||
// }
|
||||
|
||||
getTabWebContents() {
|
||||
return remote.webContents.getFocusedWebContents();
|
||||
}
|
||||
// class UpdaterPageContainer extends React.PureComponent<Props, State> {
|
||||
// constructor(props: Props) {
|
||||
// super(props);
|
||||
// this.state = props.initialState;
|
||||
// }
|
||||
|
||||
componentDidMount() {
|
||||
window.ipcRenderer.on('start-download', () => {
|
||||
this.setState({
|
||||
isDownloading: true,
|
||||
});
|
||||
});
|
||||
window.ipcRenderer.on('progress', (event, progress) => {
|
||||
this.setState({
|
||||
progress,
|
||||
});
|
||||
});
|
||||
window.ipcRenderer.on('zoom-in', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
if (activeTabWebContents.zoomLevel >= 9) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.zoomLevel += 1;
|
||||
});
|
||||
// getTabWebContents() {
|
||||
// return null;//remote.webContents.getFocusedWebContents();
|
||||
// }
|
||||
|
||||
window.ipcRenderer.on('zoom-out', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
if (activeTabWebContents.zoomLevel <= -8) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.zoomLevel -= 1;
|
||||
});
|
||||
// componentDidMount() {
|
||||
// window.ipcRenderer.on('start-download', () => {
|
||||
// this.setState({
|
||||
// isDownloading: true,
|
||||
// });
|
||||
// });
|
||||
// window.ipcRenderer.on('progress', (event, progress) => {
|
||||
// this.setState({
|
||||
// progress,
|
||||
// });
|
||||
// });
|
||||
// window.ipcRenderer.on('zoom-in', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// if (activeTabWebContents.zoomLevel >= 9) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.zoomLevel += 1;
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('zoom-reset', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.zoomLevel = 0;
|
||||
});
|
||||
// window.ipcRenderer.on('zoom-out', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// if (activeTabWebContents.zoomLevel <= -8) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.zoomLevel -= 1;
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('undo', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.undo();
|
||||
});
|
||||
// window.ipcRenderer.on('zoom-reset', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.zoomLevel = 0;
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('redo', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.redo();
|
||||
});
|
||||
// window.ipcRenderer.on('undo', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.undo();
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('cut', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.cut();
|
||||
});
|
||||
// window.ipcRenderer.on('redo', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.redo();
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('copy', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.copy();
|
||||
});
|
||||
// window.ipcRenderer.on('cut', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.cut();
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('paste', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.paste();
|
||||
});
|
||||
// window.ipcRenderer.on('copy', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.copy();
|
||||
// });
|
||||
|
||||
window.ipcRenderer.on('paste-and-match', () => {
|
||||
const activeTabWebContents = this.getTabWebContents();
|
||||
if (!activeTabWebContents) {
|
||||
return;
|
||||
}
|
||||
activeTabWebContents.pasteAndMatchStyle();
|
||||
});
|
||||
}
|
||||
// window.ipcRenderer.on('paste', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.paste();
|
||||
// });
|
||||
|
||||
render() {
|
||||
return (
|
||||
<UpdaterPage
|
||||
appName={`${remote.app.name} Desktop App`}
|
||||
notifyOnly={this.props.notifyOnly}
|
||||
{...this.state}
|
||||
onClickReleaseNotes={() => {
|
||||
window.ipcRenderer.send('click-release-notes');
|
||||
}}
|
||||
onClickSkip={() => {
|
||||
window.ipcRenderer.send('click-skip');
|
||||
}}
|
||||
onClickRemind={() => {
|
||||
window.ipcRenderer.send('click-remind');
|
||||
}}
|
||||
onClickInstall={() => {
|
||||
window.ipcRenderer.send('click-install');
|
||||
}}
|
||||
onClickDownload={() => {
|
||||
window.ipcRenderer.send('click-download');
|
||||
}}
|
||||
onClickCancel={() => {
|
||||
window.ipcRenderer.send('click-cancel');
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
// window.ipcRenderer.on('paste-and-match', () => {
|
||||
// const activeTabWebContents = this.getTabWebContents();
|
||||
// if (!activeTabWebContents) {
|
||||
// return;
|
||||
// }
|
||||
// activeTabWebContents.pasteAndMatchStyle();
|
||||
// });
|
||||
// }
|
||||
|
||||
ReactDOM.render(
|
||||
<UpdaterPageContainer
|
||||
notifyOnly={notifyOnly}
|
||||
initialState={{isDownloading: false, progress: 0}}
|
||||
/>,
|
||||
document.getElementById('content'),
|
||||
);
|
||||
// render() {
|
||||
// return (
|
||||
// <UpdaterPage
|
||||
// appName={`${remote.app.name} Desktop App`}
|
||||
// notifyOnly={this.props.notifyOnly}
|
||||
// {...this.state}
|
||||
// onClickReleaseNotes={() => {
|
||||
// window.ipcRenderer.send('click-release-notes');
|
||||
// }}
|
||||
// onClickSkip={() => {
|
||||
// window.ipcRenderer.send('click-skip');
|
||||
// }}
|
||||
// onClickRemind={() => {
|
||||
// window.ipcRenderer.send('click-remind');
|
||||
// }}
|
||||
// onClickInstall={() => {
|
||||
// window.ipcRenderer.send('click-install');
|
||||
// }}
|
||||
// onClickDownload={() => {
|
||||
// window.ipcRenderer.send('click-download');
|
||||
// }}
|
||||
// onClickCancel={() => {
|
||||
// window.ipcRenderer.send('click-cancel');
|
||||
// }}
|
||||
// />
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// ReactDOM.render(
|
||||
// <UpdaterPageContainer
|
||||
// notifyOnly={notifyOnly}
|
||||
// initialState={{isDownloading: false, progress: 0}}
|
||||
// />,
|
||||
// document.getElementById('content'),
|
||||
// );
|
||||
|
|
|
@ -1,151 +1,154 @@
|
|||
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
// TODO: Commenting out until Spectron is upgraded for Electron v14
|
||||
|
||||
const env = require('../modules/environment');
|
||||
// 'use strict';
|
||||
|
||||
describe('application', function desc() {
|
||||
this.timeout(30000);
|
||||
// const fs = require('fs');
|
||||
|
||||
beforeEach(() => {
|
||||
env.createTestUserDataDir();
|
||||
env.cleanTestConfig();
|
||||
this.app = env.getSpectronApp();
|
||||
return this.app.start();
|
||||
});
|
||||
// const env = require('../modules/environment');
|
||||
|
||||
afterEach(async () => {
|
||||
if (this.app && this.app.isRunning()) {
|
||||
await this.app.stop();
|
||||
}
|
||||
});
|
||||
// describe('application', function desc() {
|
||||
// this.timeout(30000);
|
||||
|
||||
// it('should show two windows if there is no config file', async () => {
|
||||
// await this.app.client.waitUntilWindowLoaded();
|
||||
// const count = await this.app.client.getWindowCount();
|
||||
// count.should.equal(2);
|
||||
// const opened = await this.app.browserWindow.isDevToolsOpened();
|
||||
// opened.should.be.false;
|
||||
// beforeEach(() => {
|
||||
// env.createTestUserDataDir();
|
||||
// env.cleanTestConfig();
|
||||
// this.app = env.getSpectronApp();
|
||||
// return this.app.start();
|
||||
// });
|
||||
|
||||
// const visible = await this.app.browserWindow.isVisible();
|
||||
// visible.should.be.true;
|
||||
// });
|
||||
// afterEach(async () => {
|
||||
// if (this.app && this.app.isRunning()) {
|
||||
// await this.app.stop();
|
||||
// }
|
||||
// });
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
it.skip('should show closed window with cmd+tab', async () => {
|
||||
// Unable to utilize Command key press due to: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3023#c2
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
await this.app.client.keys(['Meta', 'w']);
|
||||
let visible = await this.app.browserWindow.isVisible();
|
||||
visible.should.be.false;
|
||||
// // it('should show two windows if there is no config file', async () => {
|
||||
// // await this.app.client.waitUntilWindowLoaded();
|
||||
// // const count = await this.app.client.getWindowCount();
|
||||
// // count.should.equal(2);
|
||||
// // const opened = await this.app.browserWindow.isDevToolsOpened();
|
||||
// // opened.should.be.false;
|
||||
|
||||
this.app.client.keys(['Meta', 'Tab']);
|
||||
visible = await this.app.browserWindow.isVisible();
|
||||
visible.should.be.true;
|
||||
});
|
||||
}
|
||||
// // const visible = await this.app.browserWindow.isVisible();
|
||||
// // visible.should.be.true;
|
||||
// // });
|
||||
|
||||
it.skip('should restore window bounds', async () => {
|
||||
// bounds seems to be incorrectly calculated in some environments
|
||||
// - Windows 10: OK
|
||||
// - CircleCI: NG
|
||||
const expectedBounds = {x: 100, y: 200, width: 300, height: 400};
|
||||
fs.writeFileSync(env.boundsInfoPath, JSON.stringify(expectedBounds));
|
||||
await this.app.restart();
|
||||
const bounds = await this.app.browserWindow.getBounds();
|
||||
bounds.should.deep.equal(expectedBounds);
|
||||
});
|
||||
// if (process.platform === 'darwin') {
|
||||
// it.skip('should show closed window with cmd+tab', async () => {
|
||||
// // Unable to utilize Command key press due to: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3023#c2
|
||||
// await this.app.client.waitUntilWindowLoaded();
|
||||
// await this.app.client.keys(['Meta', 'w']);
|
||||
// let visible = await this.app.browserWindow.isVisible();
|
||||
// visible.should.be.false;
|
||||
|
||||
it('should NOT restore window bounds if the origin is located on outside of viewarea', async () => {
|
||||
// bounds seems to be incorrectly calculated in some environments (e.g. CircleCI)
|
||||
// - Windows 10: OK
|
||||
// - CircleCI: NG
|
||||
fs.writeFileSync(env.boundsInfoPath, JSON.stringify({x: -100000, y: 200, width: 300, height: 400}));
|
||||
await this.app.restart();
|
||||
let bounds = await this.app.browserWindow.getBounds();
|
||||
bounds.x.should.satisfy((x) => (x > -10000));
|
||||
// this.app.client.keys(['Meta', 'Tab']);
|
||||
// visible = await this.app.browserWindow.isVisible();
|
||||
// visible.should.be.true;
|
||||
// });
|
||||
// }
|
||||
|
||||
fs.writeFileSync(env.boundsInfoPath, JSON.stringify({x: 100, y: 200000, width: 300, height: 400}));
|
||||
await this.app.restart();
|
||||
bounds = await this.app.browserWindow.getBounds();
|
||||
bounds.y.should.satisfy((y) => (y < 10000));
|
||||
});
|
||||
// it.skip('should restore window bounds', async () => {
|
||||
// // bounds seems to be incorrectly calculated in some environments
|
||||
// // - Windows 10: OK
|
||||
// // - CircleCI: NG
|
||||
// const expectedBounds = {x: 100, y: 200, width: 300, height: 400};
|
||||
// fs.writeFileSync(env.boundsInfoPath, JSON.stringify(expectedBounds));
|
||||
// await this.app.restart();
|
||||
// const bounds = await this.app.browserWindow.getBounds();
|
||||
// bounds.should.deep.equal(expectedBounds);
|
||||
// });
|
||||
|
||||
// it('should show settings.html when there is no config file', async () => {
|
||||
// await this.app.client.waitUntilWindowLoaded();
|
||||
// await this.app.client.pause(1000);
|
||||
// const url = await this.app.client.getUrl();
|
||||
// url.should.match(/\/settings.html$/);
|
||||
// it('should NOT restore window bounds if the origin is located on outside of viewarea', async () => {
|
||||
// // bounds seems to be incorrectly calculated in some environments (e.g. CircleCI)
|
||||
// // - Windows 10: OK
|
||||
// // - CircleCI: NG
|
||||
// fs.writeFileSync(env.boundsInfoPath, JSON.stringify({x: -100000, y: 200, width: 300, height: 400}));
|
||||
// await this.app.restart();
|
||||
// let bounds = await this.app.browserWindow.getBounds();
|
||||
// bounds.x.should.satisfy((x) => (x > -10000));
|
||||
|
||||
// const existing = await this.app.client.isExisting('#newServerModal');
|
||||
// existing.should.equal(true);
|
||||
// });
|
||||
// fs.writeFileSync(env.boundsInfoPath, JSON.stringify({x: 100, y: 200000, width: 300, height: 400}));
|
||||
// await this.app.restart();
|
||||
// bounds = await this.app.browserWindow.getBounds();
|
||||
// bounds.y.should.satisfy((y) => (y < 10000));
|
||||
// });
|
||||
|
||||
// it('should show index.html when there is config file', async () => {
|
||||
// const config = {
|
||||
// version: 2,
|
||||
// teams: [{
|
||||
// name: 'example',
|
||||
// url: env.mattermostURL,
|
||||
// order: 0,
|
||||
// }, {
|
||||
// name: 'github',
|
||||
// url: 'https://github.com/',
|
||||
// order: 1,
|
||||
// }],
|
||||
// showTrayIcon: false,
|
||||
// trayIconTheme: 'light',
|
||||
// minimizeToTray: false,
|
||||
// notifications: {
|
||||
// flashWindow: 0,
|
||||
// bounceIcon: false,
|
||||
// bounceIconType: 'informational',
|
||||
// },
|
||||
// showUnreadBadge: true,
|
||||
// useSpellChecker: true,
|
||||
// enableHardwareAcceleration: true,
|
||||
// autostart: true,
|
||||
// darkMode: false,
|
||||
// };
|
||||
// fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
// await this.app.restart();
|
||||
// // it('should show settings.html when there is no config file', async () => {
|
||||
// // await this.app.client.waitUntilWindowLoaded();
|
||||
// // await this.app.client.pause(1000);
|
||||
// // const url = await this.app.client.getUrl();
|
||||
// // url.should.match(/\/settings.html$/);
|
||||
|
||||
// const url = await this.app.client.getUrl();
|
||||
// url.should.match(/\/index.html$/);
|
||||
// });
|
||||
// // const existing = await this.app.client.isExisting('#newServerModal');
|
||||
// // existing.should.equal(true);
|
||||
// // });
|
||||
|
||||
// it('should upgrade v0 config file', async () => {
|
||||
// const Config = require('../../src/common/config').default;
|
||||
// const newConfig = new Config(env.configFilePath);
|
||||
// const oldConfig = {
|
||||
// url: env.mattermostURL,
|
||||
// };
|
||||
// fs.writeFileSync(env.configFilePath, JSON.stringify(oldConfig));
|
||||
// await this.app.restart();
|
||||
// // it('should show index.html when there is config file', async () => {
|
||||
// // const config = {
|
||||
// // version: 2,
|
||||
// // teams: [{
|
||||
// // name: 'example',
|
||||
// // url: env.mattermostURL,
|
||||
// // order: 0,
|
||||
// // }, {
|
||||
// // name: 'github',
|
||||
// // url: 'https://github.com/',
|
||||
// // order: 1,
|
||||
// // }],
|
||||
// // showTrayIcon: false,
|
||||
// // trayIconTheme: 'light',
|
||||
// // minimizeToTray: false,
|
||||
// // notifications: {
|
||||
// // flashWindow: 0,
|
||||
// // bounceIcon: false,
|
||||
// // bounceIconType: 'informational',
|
||||
// // },
|
||||
// // showUnreadBadge: true,
|
||||
// // useSpellChecker: true,
|
||||
// // enableHardwareAcceleration: true,
|
||||
// // autostart: true,
|
||||
// // darkMode: false,
|
||||
// // };
|
||||
// // fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
// // await this.app.restart();
|
||||
|
||||
// const url = await this.app.client.getUrl();
|
||||
// url.should.match(/\/index.html$/);
|
||||
// // const url = await this.app.client.getUrl();
|
||||
// // url.should.match(/\/index.html$/);
|
||||
// // });
|
||||
|
||||
// const str = fs.readFileSync(env.configFilePath, 'utf8');
|
||||
// const upgradedConfig = JSON.parse(str);
|
||||
// upgradedConfig.version.should.equal(newConfig.defaultData.version);
|
||||
// });
|
||||
// // it('should upgrade v0 config file', async () => {
|
||||
// // const Config = require('../../src/common/config').default;
|
||||
// // const newConfig = new Config(env.configFilePath);
|
||||
// // const oldConfig = {
|
||||
// // url: env.mattermostURL,
|
||||
// // };
|
||||
// // fs.writeFileSync(env.configFilePath, JSON.stringify(oldConfig));
|
||||
// // await this.app.restart();
|
||||
|
||||
// it.skip('should be stopped when the app instance already exists', (done) => {
|
||||
// const secondApp = env.getSpectronApp();
|
||||
// // const url = await this.app.client.getUrl();
|
||||
// // url.should.match(/\/index.html$/);
|
||||
|
||||
// // 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.start().then(() => {
|
||||
// clearTimeout(timer);
|
||||
// return secondApp.stop();
|
||||
// }).then(() => {
|
||||
// done(new Error('Second app instance exists'));
|
||||
// });
|
||||
});
|
||||
// // const str = fs.readFileSync(env.configFilePath, 'utf8');
|
||||
// // const upgradedConfig = JSON.parse(str);
|
||||
// // upgradedConfig.version.should.equal(newConfig.defaultData.version);
|
||||
// // });
|
||||
|
||||
// // it.skip('should be stopped when the app instance already exists', (done) => {
|
||||
// // const secondApp = env.getSpectronApp();
|
||||
|
||||
// // // 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.start().then(() => {
|
||||
// // clearTimeout(timer);
|
||||
// // return secondApp.stop();
|
||||
// // }).then(() => {
|
||||
// // done(new Error('Second app instance exists'));
|
||||
// // });
|
||||
// });
|
||||
|
|
|
@ -113,20 +113,20 @@ describe('renderer/index.html', function desc() {
|
|||
// waitForVisible('#mattermostView0-fail', 20000);
|
||||
// });
|
||||
|
||||
it('shouldn\'t set window title by using webview\'s one', async () => {
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify({
|
||||
version: 2,
|
||||
teams: [{
|
||||
name: 'title_test',
|
||||
url: `http://localhost:${serverPort}`,
|
||||
order: 0,
|
||||
}],
|
||||
}));
|
||||
await this.app.restart();
|
||||
await this.app.client.pause(2000);
|
||||
const windowTitle = await this.app.browserWindow.getTitle();
|
||||
windowTitle.should.equal('Mattermost Desktop App');
|
||||
});
|
||||
// it('shouldn\'t set window title by using webview\'s one', async () => {
|
||||
// fs.writeFileSync(env.configFilePath, JSON.stringify({
|
||||
// version: 2,
|
||||
// teams: [{
|
||||
// name: 'title_test',
|
||||
// url: `http://localhost:${serverPort}`,
|
||||
// order: 0,
|
||||
// }],
|
||||
// }));
|
||||
// await this.app.restart();
|
||||
// await this.app.client.pause(2000);
|
||||
// const windowTitle = await this.app.browserWindow.getTitle();
|
||||
// windowTitle.should.equal('Mattermost Desktop App');
|
||||
// });
|
||||
|
||||
// Skip because it's very unstable in CI
|
||||
// it.skip('should update window title when the activated tab\'s title is updated', async () => {
|
||||
|
|
Loading…
Reference in a new issue