[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

@@ -8,7 +8,8 @@ import {app, BrowserWindow} from 'electron';
import {Args} from 'types/args';
import {BACK_BAR_HEIGHT, PRODUCTION, TAB_BAR_HEIGHT} from 'common/utils/constants';
import {BACK_BAR_HEIGHT, customLoginRegexPaths, PRODUCTION, TAB_BAR_HEIGHT} from 'common/utils/constants';
import UrlUtils from 'common/utils/url';
import Utils from 'common/utils/util';
export function shouldBeHiddenOnStartup(parsedArgv: Args) {
@@ -37,6 +38,28 @@ export function getAdjustedWindowBoundaries(width: number, height: number, hasBa
};
}
export function shouldHaveBackBar(serverUrl: URL | string, inputURL: URL | string) {
if (UrlUtils.isUrlType('login', serverUrl, inputURL)) {
const serverURL = UrlUtils.parseURL(serverUrl);
const subpath = serverURL ? serverURL.pathname : '';
const parsedURL = UrlUtils.parseURL(inputURL);
if (!parsedURL) {
return false;
}
const urlPath = parsedURL.pathname;
const replacement = subpath.endsWith('/') ? '/' : '';
const replacedPath = urlPath.replace(subpath, replacement);
for (const regexPath of customLoginRegexPaths) {
if (replacedPath.match(regexPath)) {
return true;
}
}
return false;
}
return !UrlUtils.isTeamUrl(serverUrl, inputURL) && !UrlUtils.isAdminUrl(serverUrl, inputURL);
}
export function getLocalURLString(urlPath: string, query?: Map<string, string>, isMain?: boolean) {
let pathname;
const processPath = isMain ? '' : '/renderer';