diff --git a/src/libs/E2E/client.ts b/src/libs/E2E/client.ts index 3088f280038c..b9965b7da0cb 100644 --- a/src/libs/E2E/client.ts +++ b/src/libs/E2E/client.ts @@ -24,12 +24,6 @@ const defaultRequestInit: RequestInit = { }; const sendRequest = (url: string, data: Record): Promise => { - // Don't process these specific API commands because running them over and over again in the tests hammers the server in a bad way. - if (url.includes('command=OptInToPushNotifications') || url.includes('command=OptOutOfPushNotifications')) { - console.debug('Skipping request to opt in or out of push notifications'); - return Promise.resolve(new Response()); - } - return fetch(url, { method: 'POST', headers: { diff --git a/src/libs/E2E/utils/NetworkInterceptor.ts b/src/libs/E2E/utils/NetworkInterceptor.ts index 511c8014f0cd..efa4c3c7e780 100644 --- a/src/libs/E2E/utils/NetworkInterceptor.ts +++ b/src/libs/E2E/utils/NetworkInterceptor.ts @@ -155,6 +155,15 @@ export default function installNetworkInterceptor( const options = fetchArgsGetRequestInit(args); const headers = getFetchRequestHeadersAsObject(options); const url = fetchArgsGetUrl(args); + + // Don't process these specific API commands because running them over and over again in the tests increases the size of the notificationPreferences NVP on the server to an infinite size. + // This is due to the NVP storing this setting once for each user's device, and since the E2E tests use AWS device farm, the user ends up with thousands of different devices, + // unlike normal users that might only ever have about a dozen. We found the NVP was over 2.5mb in size and that slows down database replication. + if (url.includes('OptInToPushNotifications') || url.includes('OptOutOfPushNotifications')) { + console.debug('Skipping request to opt in or out of push notifications'); + return Promise.resolve(new Response()); + } + // Check if headers contain any of the ignored headers, or if react native metro server: if (IGNORE_REQUEST_HEADERS.some((header) => headers[header] != null) || url.includes('8081')) { return originalFetch(...args);