Skip to content

Commit

Permalink
fix: linking test for chats
Browse files Browse the repository at this point in the history
  • Loading branch information
adhorodyski committed Nov 5, 2024
1 parent 0a7c65d commit 50ff01b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/libs/E2E/tests/linkingTest.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {DeviceEventEmitter} from 'react-native';
import Config from 'react-native-config';
import type {NativeConfig} from 'react-native-config';
import E2ELogin from '@libs/E2E/actions/e2eLogin';
import waitForAppLoaded from '@libs/E2E/actions/waitForAppLoaded';
Expand All @@ -21,16 +22,17 @@ const test = (config: NativeConfig) => {

const reportID = getConfigValueOrThrow('reportID', config);
const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config);
const name = getConfigValueOrThrow('name', config);

E2ELogin().then((neededLogin) => {
if (neededLogin) {
return waitForAppLoaded().then(() => E2EClient.submitTestDone());
}

const [appearMessagePromise, appearMessageResolve] = getPromiseWithResolve();
const [switchReportPromise] = getPromiseWithResolve();
const [openReportPromise, openReportResolve] = getPromiseWithResolve();

Promise.all([appearMessagePromise, switchReportPromise])
Promise.all([appearMessagePromise, openReportPromise])
.then(() => {
console.debug('[E2E] Test completed successfully, exiting…');
E2EClient.submitTestDone();
Expand All @@ -56,6 +58,18 @@ const test = (config: NativeConfig) => {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID));
return;
}

if (entry.name === CONST.TIMING.OPEN_REPORT) {
console.debug('[E2E] Linking: 1');

E2EClient.submitTestResults({
branch: Config.E2E_BRANCH,
name,
metric: entry.duration,
unit: 'ms',
});
openReportResolve();
}
});
});
};
Expand Down

0 comments on commit 50ff01b

Please sign in to comment.