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