[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:
Devin Binnie
2022-04-08 15:04:00 -04:00
committed by GitHub
parent dbe48e796c
commit 9b466b67f6
10 changed files with 500 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ import MessagingTabView from 'common/tabs/MessagingTabView';
import * as WindowManager from '../windows/windowManager';
import * as appState from '../appState';
import Utils from '../utils';
import {MattermostView} from './MattermostView';
@@ -44,6 +45,7 @@ jest.mock('../utils', () => ({
getWindowBoundaries: jest.fn(),
getLocalPreload: (file) => file,
composeUserAgent: () => 'Mattermost/5.0.0',
shouldHaveBackBar: jest.fn(),
}));
const server = new MattermostServer('server_name', 'http://server-1.com');
@@ -280,11 +282,13 @@ describe('main/views/MattermostView', () => {
});
it('should hide back button on internal url', () => {
Utils.shouldHaveBackBar.mockReturnValue(false);
mattermostView.handleDidNavigate(null, 'http://server-1.com/path/to/channels');
expect(WindowManager.sendToRenderer).toHaveBeenCalledWith(TOGGLE_BACK_BUTTON, false);
});
it('should show back button on external url', () => {
Utils.shouldHaveBackBar.mockReturnValue(true);
mattermostView.handleDidNavigate(null, 'http://server-2.com/some/other/path');
expect(WindowManager.sendToRenderer).toHaveBeenCalledWith(TOGGLE_BACK_BUTTON, true);
});