From 9dc7f80a27e61e74f534f9129a386011061461d2 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 23 Oct 2024 17:09:59 +0200 Subject: [PATCH] e2e: unify test metrics naming --- src/libs/E2E/tests/appStartTimeTest.e2e.ts | 7 +++++-- src/libs/E2E/tests/chatOpeningTest.e2e.ts | 5 +++-- src/libs/E2E/tests/linkingTest.e2e.ts | 3 ++- src/libs/E2E/tests/openSearchRouterTest.e2e.ts | 14 +++++++++----- src/libs/E2E/tests/reportTypingTest.e2e.ts | 5 +++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/libs/E2E/tests/appStartTimeTest.e2e.ts b/src/libs/E2E/tests/appStartTimeTest.e2e.ts index 188dd65c85e9..ccd781e08514 100644 --- a/src/libs/E2E/tests/appStartTimeTest.e2e.ts +++ b/src/libs/E2E/tests/appStartTimeTest.e2e.ts @@ -1,11 +1,14 @@ import Config from 'react-native-config'; +import type {NativeConfig} from 'react-native-config'; 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 getConfigValueOrThrow from '@libs/E2E/utils/getConfigValueOrThrow'; import Performance from '@libs/Performance'; -const test = () => { +const test = (config: NativeConfig) => { + const name = getConfigValueOrThrow('name', config); // check for login (if already logged in the action will simply resolve) E2ELogin().then((neededLogin) => { if (neededLogin) { @@ -25,7 +28,7 @@ const test = () => { metrics.map((metric) => E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: `App start ${metric.name}`, + name: `${name} ${metric.name}`, metric: metric.duration, unit: 'ms', }), diff --git a/src/libs/E2E/tests/chatOpeningTest.e2e.ts b/src/libs/E2E/tests/chatOpeningTest.e2e.ts index 8e2a0a81da7d..cf0c4889aa69 100644 --- a/src/libs/E2E/tests/chatOpeningTest.e2e.ts +++ b/src/libs/E2E/tests/chatOpeningTest.e2e.ts @@ -15,6 +15,7 @@ const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for chat opening'); const reportID = getConfigValueOrThrow('reportID', config); + const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { if (neededLogin) { @@ -48,7 +49,7 @@ const test = (config: NativeConfig) => { if (entry.name === CONST.TIMING.CHAT_RENDER) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Chat opening', + name: `${name} Chat opening`, metric: entry.duration, unit: 'ms', }) @@ -64,7 +65,7 @@ const test = (config: NativeConfig) => { if (entry.name === CONST.TIMING.OPEN_REPORT) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Chat TTI', + name: `${name} Chat TTI`, metric: entry.duration, unit: 'ms', }) diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index c4d580e8c57b..18ba438c2ca6 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -24,6 +24,7 @@ const test = (config: NativeConfig) => { const reportID = getConfigValueOrThrow('reportID', config); const linkedReportID = getConfigValueOrThrow('linkedReportID', config); const linkedReportActionID = getConfigValueOrThrow('linkedReportActionID', config); + const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { if (neededLogin) { @@ -74,7 +75,7 @@ const test = (config: NativeConfig) => { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Comment linking', + name, metric: entry.duration, unit: 'ms', }); diff --git a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts index 48278aee536a..de9464c9c286 100644 --- a/src/libs/E2E/tests/openSearchRouterTest.e2e.ts +++ b/src/libs/E2E/tests/openSearchRouterTest.e2e.ts @@ -1,16 +1,20 @@ import Config from 'react-native-config'; +import type {NativeConfig} from 'react-native-config'; import * as E2EGenericPressableWrapper from '@components/Pressable/GenericPressable/index.e2e'; 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 getPromiseWithResolve from '@libs/E2E/utils/getPromiseWithResolve'; import Performance from '@libs/Performance'; import CONST from '@src/CONST'; -const test = () => { +const test = (config: NativeConfig) => { // check for login (if already logged in the action will simply resolve) console.debug('[E2E] Logging in for new search router'); + const name = getConfigValueOrThrow('name', config); + E2ELogin().then((neededLogin: boolean): Promise | undefined => { if (neededLogin) { return waitForAppLoaded().then(() => @@ -39,7 +43,7 @@ const test = () => { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, error: 'Search button not found', - name: 'Open Search Router TTI', + name: `${name} Open Search Router TTI`, }).then(() => E2EClient.submitTestDone()); return; } @@ -48,7 +52,7 @@ const test = () => { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, error: 'Search button found but onPress prop was not present', - name: 'Open Search Router TTI', + name: `${name} Open Search Router TTI`, }).then(() => E2EClient.submitTestDone()); return; } @@ -59,7 +63,7 @@ const test = () => { if (entry.name === CONST.TIMING.SEARCH_ROUTER_RENDER) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Open Search Router TTI', + name: `${name} Open Search Router TTI`, metric: entry.duration, unit: 'ms', }) @@ -75,7 +79,7 @@ const test = () => { if (entry.name === CONST.TIMING.LOAD_SEARCH_OPTIONS) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Load Search Options', + name: `${name} Load Search Options`, metric: entry.duration, unit: 'ms', }) diff --git a/src/libs/E2E/tests/reportTypingTest.e2e.ts b/src/libs/E2E/tests/reportTypingTest.e2e.ts index efe1c380dfd0..e042a688c37d 100644 --- a/src/libs/E2E/tests/reportTypingTest.e2e.ts +++ b/src/libs/E2E/tests/reportTypingTest.e2e.ts @@ -21,6 +21,7 @@ const test = (config: NativeConfig) => { const reportID = getConfigValueOrThrow('reportID', config); const message = getConfigValueOrThrow('message', config); + const name = getConfigValueOrThrow('name', config); E2ELogin().then((neededLogin) => { if (neededLogin) { @@ -45,7 +46,7 @@ const test = (config: NativeConfig) => { if (entry.name === CONST.TIMING.MESSAGE_SENT) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Message sent', + name: `${name} Message sent`, metric: entry.duration, unit: 'ms', }).then(messageSentResolve); @@ -77,7 +78,7 @@ const test = (config: NativeConfig) => { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, - name: 'Composer typing rerender count', + name: `${name} Composer typing rerender count`, metric: rerenderCount, unit: 'renders', })