Skip to content

Commit

Permalink
chore: changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Jun 5, 2024
1 parent 25cecda commit f985b24
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 23 deletions.
3 changes: 2 additions & 1 deletion src/libs/E2E/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Config from '../../../tests/e2e/config';
import Routes from '../../../tests/e2e/server/routes';
import type {NetworkCacheMap, TestConfig, TestResult} from './types';
import {waitForActiveRequestsToBeEmpty} from './utils/NetworkInterceptor';

type NativeCommandPayload = {
text: string;
Expand Down Expand Up @@ -57,7 +58,7 @@ const submitTestResults = (testResult: TestResult): Promise<void> => {
});
};

const submitTestDone = () => fetch(`${SERVER_ADDRESS}${Routes.testDone}`, defaultRequestInit);
const submitTestDone = () => waitForActiveRequestsToBeEmpty().then(() => fetch(`${SERVER_ADDRESS}${Routes.testDone}`, defaultRequestInit));

let currentActiveTestConfig: TestConfig | null = null;

Expand Down
2 changes: 0 additions & 2 deletions src/libs/E2E/tests/appStartTimeTest.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {PerformanceEntry} from 'react-native-performance';
import E2ELogin from '@libs/E2E/actions/e2eLogin';
import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded';
import E2EClient from '@libs/E2E/client';
import {waitForActiveRequestsToBeEmpty} from '@libs/E2E/utils/NetworkInterceptor';
import Performance from '@libs/Performance';

const test = () => {
Expand Down Expand Up @@ -31,7 +30,6 @@ const test = () => {
}),
),
)
.then(waitForActiveRequestsToBeEmpty)
.then(() => {
console.debug('[E2E] Done, exiting…');
E2EClient.submitTestDone();
Expand Down
11 changes: 4 additions & 7 deletions src/libs/E2E/tests/chatOpeningTest.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded';
import E2EClient from '@libs/E2E/client';
import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow';
import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve';
import {waitForActiveRequestsToBeEmpty} from '@libs/E2E/utils/NetworkInterceptor';
import Navigation from '@libs/Navigation/Navigation';
import Performance from '@libs/Performance';
import CONST from '@src/CONST';
Expand All @@ -30,13 +29,11 @@ const test = (config: NativeConfig) => {
const [renderChatPromise, renderChatResolve] = getPromiseWithResolve();
const [chatTTIPromise, chatTTIResolve] = getPromiseWithResolve();

Promise.all([renderChatPromise, chatTTIPromise])
.then(waitForActiveRequestsToBeEmpty)
.then(() => {
console.debug(`[E2E] Submitting!`);
Promise.all([renderChatPromise, chatTTIPromise]).then(() => {
console.debug(`[E2E] Submitting!`);

E2EClient.submitTestDone();
});
E2EClient.submitTestDone();
});

Performance.subscribeToMeasurements((entry) => {
if (entry.name === CONST.TIMING.SIDEBAR_LOADED) {
Expand Down
2 changes: 0 additions & 2 deletions src/libs/E2E/tests/linkingTest.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import E2ELogin from '@libs/E2E/actions/e2eLogin';
import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded';
import E2EClient from '@libs/E2E/client';
import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow';
import {waitForActiveRequestsToBeEmpty} from '@libs/E2E/utils/NetworkInterceptor';
import Navigation from '@libs/Navigation/Navigation';
import Performance from '@libs/Performance';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -52,7 +51,6 @@ const test = (config: NativeConfig) => {
name: 'Comment linking',
duration: entry.duration,
})
.then(waitForActiveRequestsToBeEmpty)
.then(() => {
console.debug('[E2E] Test completed successfully, exiting…');
E2EClient.submitTestDone();
Expand Down
11 changes: 4 additions & 7 deletions src/libs/E2E/tests/openChatFinderPageTest.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import E2ELogin from '@libs/E2E/actions/e2eLogin';
import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded';
import E2EClient from '@libs/E2E/client';
import getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve';
import {waitForActiveRequestsToBeEmpty} from '@libs/E2E/utils/NetworkInterceptor';
import Navigation from '@libs/Navigation/Navigation';
import Performance from '@libs/Performance';
import CONST from '@src/CONST';
Expand All @@ -26,13 +25,11 @@ const test = () => {
const [openSearchPagePromise, openSearchPageResolve] = getPromiseWithResolve();
const [loadSearchOptionsPromise, loadSearchOptionsResolve] = getPromiseWithResolve();

Promise.all([openSearchPagePromise, loadSearchOptionsPromise])
.then(waitForActiveRequestsToBeEmpty)
.then(() => {
console.debug(`[E2E] Submitting!`);
Promise.all([openSearchPagePromise, loadSearchOptionsPromise]).then(() => {
console.debug(`[E2E] Submitting!`);

E2EClient.submitTestDone();
});
E2EClient.submitTestDone();
});

Performance.subscribeToMeasurements((entry) => {
if (entry.name === CONST.TIMING.SIDEBAR_LOADED) {
Expand Down
5 changes: 1 addition & 4 deletions src/libs/E2E/tests/reportTypingTest.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded';
import waitForKeyboard from '@libs/E2E/actions/waitForKeyboard';
import E2EClient from '@libs/E2E/client';
import getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow';
import {waitForActiveRequestsToBeEmpty} from '@libs/E2E/utils/NetworkInterceptor';
import Navigation from '@libs/Navigation/Navigation';
import Performance from '@libs/Performance';
import {getRerenderCount, resetRerenderCount} from '@pages/home/report/ReportActionCompose/ComposerWithSuggestions/index.e2e';
Expand Down Expand Up @@ -55,9 +54,7 @@ const test = (config: NativeConfig) => {
branch: Config.E2E_BRANCH,
name: 'Composer typing rerender count',
renderCount: rerenderCount,
})
.then(waitForActiveRequestsToBeEmpty)
.then(E2EClient.submitTestDone);
}).then(E2EClient.submitTestDone);
}, 3000);
})
.catch((error) => {
Expand Down

0 comments on commit f985b24

Please sign in to comment.