Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] Skip calling specific APIs in the E2E tests #53704

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/libs/E2E/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ const defaultRequestInit: RequestInit = {
};

const sendRequest = (url: string, data: Record<string, unknown>): Promise<Response> => {
// 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: {
Expand Down
9 changes: 9 additions & 0 deletions src/libs/E2E/utils/NetworkInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading