From 19094f27ebb3e06b5dee8f7ba1be2b018372bf6f Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Mon, 15 Nov 2021 13:58:23 -0800 Subject: [PATCH] Disable logbox when RUNNING_E2E=true (#5831) --- .env | 1 + app/mattermost.js | 7 ++++++- env.d.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env b/.env index be80b9ea5..00c2df5b7 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ STORYBOOK_PORT= STORYBOOK_HOST= +RUNNING_E2E= diff --git a/app/mattermost.js b/app/mattermost.js index 54e0b99e9..5c3047a77 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {Linking} from 'react-native'; +import {Linking, LogBox} from 'react-native'; import {Navigation} from 'react-native-navigation'; import {Provider} from 'react-redux'; @@ -10,6 +10,7 @@ import {setDeepLinkURL} from '@actions/views/root'; import {loadMe, logout} from '@actions/views/user'; import {NavigationTypes} from '@constants'; import {CHANNEL, THREAD} from '@constants/screen'; +import {RUNNING_E2E} from '@env'; import {getAppCredentials} from '@init/credentials'; import {setupPermanentSidebar} from '@init/device'; import emmProvider from '@init/emm_provider'; @@ -154,3 +155,7 @@ export function componentDidDisappearListener({componentId}) { } } } + +// Ignore all notifications if running e2e +const isRunningE2e = RUNNING_E2E === 'true'; +LogBox.ignoreAllLogs(isRunningE2e); diff --git a/env.d.ts b/env.d.ts index c7809fc5b..e938bd6de 100644 --- a/env.d.ts +++ b/env.d.ts @@ -5,4 +5,5 @@ declare module '@env' { export const STORYBOOK_HOST: string; export const STORYBOOK_PORT: number; + export const RUNNING_E2E: string; }