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 1 commit
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
7 changes: 7 additions & 0 deletions src/libs/E2E/utils/NetworkInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ 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 hammers the server in a bad way.
hannojg marked this conversation as resolved.
Show resolved Hide resolved
if (url.includes('command=OptInToPushNotifications') || url.includes('command=OptOutOfPushNotifications')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (url.includes('command=OptInToPushNotifications') || url.includes('command=OptOutOfPushNotifications')) {
if (url.includes('api/OptInToPushNotifications') || url.includes('api/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