[MM-39793][MM-T2633] E2E Test: Use back button to return to the desktop app login - and fixes (#2043)
* [MM-39793][MM-T2633] E2E Test: Use back button to return to the desktop app login - and fixes * Lint and test fixes
This commit is contained in:
@@ -26,7 +26,7 @@ import {TabView} from 'common/tabs/TabView';
|
||||
|
||||
import {ServerInfo} from 'main/server/serverInfo';
|
||||
import ContextMenu from '../contextMenu';
|
||||
import {getWindowBoundaries, getLocalPreload, composeUserAgent} from '../utils';
|
||||
import {getWindowBoundaries, getLocalPreload, composeUserAgent, shouldHaveBackBar} from '../utils';
|
||||
import WindowManager from '../windows/windowManager';
|
||||
import * as appState from '../appState';
|
||||
|
||||
@@ -217,7 +217,7 @@ export class MattermostView extends EventEmitter {
|
||||
this.status = Status.WAITING_MM;
|
||||
this.removeLoading = setTimeout(this.setInitialized, MAX_LOADING_SCREEN_SECONDS, true);
|
||||
this.emit(LOAD_SUCCESS, this.tab.name, loadURL);
|
||||
this.setBounds(getWindowBoundaries(this.window, !(urlUtils.isTeamUrl(this.tab.url || '', this.view.webContents.getURL()) || urlUtils.isAdminUrl(this.tab.url || '', this.view.webContents.getURL()))));
|
||||
this.setBounds(getWindowBoundaries(this.window, shouldHaveBackBar(this.tab.url || '', this.view.webContents.getURL())));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ export class MattermostView extends EventEmitter {
|
||||
const request = typeof requestedVisibility === 'undefined' ? true : requestedVisibility;
|
||||
if (request && !this.isVisible) {
|
||||
this.window.addBrowserView(this.view);
|
||||
this.setBounds(getWindowBoundaries(this.window, !(urlUtils.isTeamUrl(this.tab.url || '', this.view.webContents.getURL()) || urlUtils.isAdminUrl(this.tab.url || '', this.view.webContents.getURL()))));
|
||||
this.setBounds(getWindowBoundaries(this.window, shouldHaveBackBar(this.tab.url || '', this.view.webContents.getURL())));
|
||||
if (this.status === Status.READY) {
|
||||
this.focus();
|
||||
}
|
||||
@@ -341,15 +341,14 @@ export class MattermostView extends EventEmitter {
|
||||
handleDidNavigate = (event: Event, url: string) => {
|
||||
log.debug('MattermostView.handleDidNavigate', {tabName: this.tab.name, url});
|
||||
|
||||
const isUrlTeamUrl = urlUtils.isTeamUrl(this.tab.url || '', url) || urlUtils.isAdminUrl(this.tab.url || '', url);
|
||||
if (isUrlTeamUrl) {
|
||||
this.setBounds(getWindowBoundaries(this.window));
|
||||
WindowManager.sendToRenderer(TOGGLE_BACK_BUTTON, false);
|
||||
log.info('hide back button');
|
||||
} else {
|
||||
if (shouldHaveBackBar(this.tab.url || '', url)) {
|
||||
this.setBounds(getWindowBoundaries(this.window, true));
|
||||
WindowManager.sendToRenderer(TOGGLE_BACK_BUTTON, true);
|
||||
log.info('show back button');
|
||||
} else {
|
||||
this.setBounds(getWindowBoundaries(this.window));
|
||||
WindowManager.sendToRenderer(TOGGLE_BACK_BUTTON, false);
|
||||
log.info('hide back button');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user