Skip to content

Commit

Permalink
Merge pull request #53604 from Expensify/tgolen-skip-apis-in-e2e-tests
Browse files Browse the repository at this point in the history
[No QA] Skip calling specific APIs in the E2E tests
  • Loading branch information
mountiny authored Dec 5, 2024
2 parents dc18d0b + 95e7de9 commit 9184118
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/libs/E2E/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ const defaultRequestInit: RequestInit = {
headers: defaultHeaders,
};

const sendRequest = (url: string, data: Record<string, unknown>): Promise<Response> =>
fetch(url, {
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: {
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -46,6 +52,7 @@ const sendRequest = (url: string, data: Record<string, unknown>): Promise<Respon
throw new Error(errorMsg);
});
});
};

/**
* Submits a test result to the server.
Expand Down

0 comments on commit 9184118

Please sign in to comment.